-Tests
This commit is contained in:
@@ -59,7 +59,7 @@ namespace Newtonsoft.Json.Tests.Bson
|
||||
[Test]
|
||||
public void DeserializeLargeBsonObject()
|
||||
{
|
||||
byte[] data = System.IO.File.ReadAllBytes(@"SpaceShipV2.bson");
|
||||
byte[] data = System.IO.File.ReadAllBytes(ResolvePath(@"SpaceShipV2.bson"));
|
||||
|
||||
MemoryStream ms = new MemoryStream(data);
|
||||
BsonReader reader = new BsonReader(ms);
|
||||
|
||||
@@ -617,7 +617,7 @@ namespace Newtonsoft.Json.Tests
|
||||
JArray largeJson;
|
||||
|
||||
// read asynchronously from a file
|
||||
using (TextReader textReader = new StreamReader(new FileStream(@"large.json", FileMode.Open, FileAccess.Read, FileShare.Read, 4096, true)))
|
||||
using (TextReader textReader = new StreamReader(new FileStream(ResolvePath(@"large.json"), FileMode.Open, FileAccess.Read, FileShare.Read, 4096, true)))
|
||||
{
|
||||
largeJson = await JArray.LoadAsync(new JsonTextReader(textReader));
|
||||
}
|
||||
@@ -626,7 +626,7 @@ namespace Newtonsoft.Json.Tests
|
||||
user["isActive"] = false;
|
||||
|
||||
// write asynchronously to a file
|
||||
using (TextWriter textWriter = new StreamWriter(new FileStream(@"large.json", FileMode.Open, FileAccess.Write, FileShare.Write, 4096, true)))
|
||||
using (TextWriter textWriter = new StreamWriter(new FileStream(ResolvePath(@"large.json"), FileMode.Open, FileAccess.Write, FileShare.Write, 4096, true)))
|
||||
{
|
||||
await largeJson.WriteToAsync(new JsonTextWriter(textWriter));
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
{
|
||||
dynamic d;
|
||||
|
||||
using (var jsonFile = System.IO.File.OpenText("large.json"))
|
||||
using (var jsonFile = System.IO.File.OpenText(ResolvePath("large.json")))
|
||||
using (JsonTextReader jsonTextReader = new JsonTextReader(jsonFile))
|
||||
{
|
||||
JsonSerializer serializer = new JsonSerializer();
|
||||
|
||||
@@ -182,7 +182,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
[Test]
|
||||
public void DontCloseInputOnDeserializeError()
|
||||
{
|
||||
using (var s = System.IO.File.OpenRead("large.json"))
|
||||
using (var s = System.IO.File.OpenRead(ResolvePath("large.json")))
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -210,6 +210,15 @@ namespace Newtonsoft.Json.Tests
|
||||
}
|
||||
#endif
|
||||
|
||||
protected string ResolvePath(string path)
|
||||
{
|
||||
#if !DNXCORE50
|
||||
return Path.Combine(TestContext.CurrentContext.TestDirectory, path);
|
||||
#else
|
||||
return path;
|
||||
#endif
|
||||
}
|
||||
|
||||
protected string GetOffset(DateTime d, DateFormatHandling dateFormatHandling)
|
||||
{
|
||||
char[] chars = new char[8];
|
||||
|
||||
Reference in New Issue
Block a user