Merge branch 'master' of github.com:JamesNK/Newtonsoft.Json
This commit is contained in:
@@ -52,6 +52,8 @@ namespace Newtonsoft.Json.Tests
|
|||||||
{
|
{
|
||||||
[Test]
|
[Test]
|
||||||
public void DefaultSettings()
|
public void DefaultSettings()
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
JsonConvert.DefaultSettings = () => new JsonSerializerSettings
|
JsonConvert.DefaultSettings = () => new JsonSerializerSettings
|
||||||
{
|
{
|
||||||
@@ -68,9 +70,16 @@ namespace Newtonsoft.Json.Tests
|
|||||||
]
|
]
|
||||||
}", json);
|
}", json);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
JsonConvert.DefaultSettings = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void DefaultSettings_Override()
|
public void DefaultSettings_Override()
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
JsonConvert.DefaultSettings = () => new JsonSerializerSettings
|
JsonConvert.DefaultSettings = () => new JsonSerializerSettings
|
||||||
{
|
{
|
||||||
@@ -84,9 +93,16 @@ namespace Newtonsoft.Json.Tests
|
|||||||
|
|
||||||
Assert.AreEqual(@"{""test"":[1,2,3]}", json);
|
Assert.AreEqual(@"{""test"":[1,2,3]}", json);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
JsonConvert.DefaultSettings = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void DefaultSettings_Override_JsonConverterOrder()
|
public void DefaultSettings_Override_JsonConverterOrder()
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
JsonConvert.DefaultSettings = () => new JsonSerializerSettings
|
JsonConvert.DefaultSettings = () => new JsonSerializerSettings
|
||||||
{
|
{
|
||||||
@@ -107,9 +123,16 @@ namespace Newtonsoft.Json.Tests
|
|||||||
|
|
||||||
Assert.AreEqual(@"[new Date(976593724000)]", json);
|
Assert.AreEqual(@"[new Date(976593724000)]", json);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
JsonConvert.DefaultSettings = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void DefaultSettings_Create()
|
public void DefaultSettings_Create()
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
JsonConvert.DefaultSettings = () => new JsonSerializerSettings
|
JsonConvert.DefaultSettings = () => new JsonSerializerSettings
|
||||||
{
|
{
|
||||||
@@ -146,9 +169,16 @@ namespace Newtonsoft.Json.Tests
|
|||||||
|
|
||||||
Assert.AreEqual(@"[1,2,3]", sw.ToString());
|
Assert.AreEqual(@"[1,2,3]", sw.ToString());
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
JsonConvert.DefaultSettings = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void DefaultSettings_CreateWithSettings()
|
public void DefaultSettings_CreateWithSettings()
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
JsonConvert.DefaultSettings = () => new JsonSerializerSettings
|
JsonConvert.DefaultSettings = () => new JsonSerializerSettings
|
||||||
{
|
{
|
||||||
@@ -190,6 +220,11 @@ namespace Newtonsoft.Json.Tests
|
|||||||
3
|
3
|
||||||
]", sw.ToString());
|
]", sw.ToString());
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
JsonConvert.DefaultSettings = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public class IntConverter : JsonConverter
|
public class IntConverter : JsonConverter
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ using NUnit.Framework;
|
|||||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||||
using TestMethod = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
using TestMethod = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||||
using Setup = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestInitialize;
|
using SetUp = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestInitializeAttribute;
|
||||||
#endif
|
#endif
|
||||||
using Newtonsoft.Json.Utilities;
|
using Newtonsoft.Json.Utilities;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
|
|||||||
Reference in New Issue
Block a user