-Derp
This commit is contained in:
@@ -87,6 +87,40 @@ namespace Newtonsoft.Json.Tests
|
|||||||
public const string JsonText =
|
public const string JsonText =
|
||||||
@"{""strings"":[null,""Markus egger ]><[, (2nd)"",null],""dictionary"":{""Val & asd1"":1,""Val2 & asd1"":3,""Val3 & asd1"":4},""Name"":""Rick"",""Now"":""\/Date(1262301136080+1300)\/"",""BigNumber"":34123123123.121,""Address1"":{""Street"":""fff Street"",""Phone"":""(503) 814-6335"",""Entered"":""\/Date(1264025536080+1300)\/""},""Addresses"":[{""Street"":""\u001farray<address"",""Phone"":""(503) 814-6335"",""Entered"":""\/Date(1262211136080+1300)\/""},{""Street"":""array 2 address"",""Phone"":""(503) 814-6335"",""Entered"":""\/Date(1262124736080+1300)\/""}]}";
|
@"{""strings"":[null,""Markus egger ]><[, (2nd)"",null],""dictionary"":{""Val & asd1"":1,""Val2 & asd1"":3,""Val3 & asd1"":4},""Name"":""Rick"",""Now"":""\/Date(1262301136080+1300)\/"",""BigNumber"":34123123123.121,""Address1"":{""Street"":""fff Street"",""Phone"":""(503) 814-6335"",""Entered"":""\/Date(1264025536080+1300)\/""},""Addresses"":[{""Street"":""\u001farray<address"",""Phone"":""(503) 814-6335"",""Entered"":""\/Date(1262211136080+1300)\/""},{""Street"":""array 2 address"",""Phone"":""(503) 814-6335"",""Entered"":""\/Date(1262124736080+1300)\/""}]}";
|
||||||
|
|
||||||
|
public const string JsonIndentedText =
|
||||||
|
@"{
|
||||||
|
""strings"": [
|
||||||
|
null,
|
||||||
|
""Markus egger ]><[, (2nd)"",
|
||||||
|
null
|
||||||
|
],
|
||||||
|
""dictionary"": {
|
||||||
|
""Val & asd1"": 1,
|
||||||
|
""Val2 & asd1"": 3,
|
||||||
|
""Val3 & asd1"": 4
|
||||||
|
},
|
||||||
|
""Name"": ""Rick"",
|
||||||
|
""Now"": ""/Date(1262301136080+1300)/"",
|
||||||
|
""BigNumber"": 34123123123.121,
|
||||||
|
""Address1"": {
|
||||||
|
""Street"": ""fff Street"",
|
||||||
|
""Phone"": ""(503) 814-6335"",
|
||||||
|
""Entered"": ""/Date(1264025536080+1300)/""
|
||||||
|
},
|
||||||
|
""Addresses"": [
|
||||||
|
{
|
||||||
|
""Street"": ""\u001farray<address"",
|
||||||
|
""Phone"": ""(503) 814-6335"",
|
||||||
|
""Entered"": ""/Date(1262211136080+1300)/""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
""Street"": ""array 2 address"",
|
||||||
|
""Phone"": ""(503) 814-6335"",
|
||||||
|
""Entered"": ""/Date(1262124736080+1300)/""
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}";
|
||||||
|
|
||||||
private const string JsonIsoText =
|
private const string JsonIsoText =
|
||||||
@"{""strings"":[null,""Markus egger ]><[, (2nd)"",null],""dictionary"":{""Val & asd1"":1,""Val2 & asd1"":3,""Val3 & asd1"":4},""Name"":""Rick"",""Now"":""2012-02-25T19:55:50.6095676+13:00"",""BigNumber"":34123123123.121,""Address1"":{""Street"":""fff Street"",""Phone"":""(503) 814-6335"",""Entered"":""2012-02-24T18:55:50.6095676+13:00""},""Addresses"":[{""Street"":""\u001farray<address"",""Phone"":""(503) 814-6335"",""Entered"":""2012-02-24T18:55:50.6095676+13:00""},{""Street"":""array 2 address"",""Phone"":""(503) 814-6335"",""Entered"":""2012-02-24T18:55:50.6095676+13:00""}]}";
|
@"{""strings"":[null,""Markus egger ]><[, (2nd)"",null],""dictionary"":{""Val & asd1"":1,""Val2 & asd1"":3,""Val3 & asd1"":4},""Name"":""Rick"",""Now"":""2012-02-25T19:55:50.6095676+13:00"",""BigNumber"":34123123123.121,""Address1"":{""Street"":""fff Street"",""Phone"":""(503) 814-6335"",""Entered"":""2012-02-24T18:55:50.6095676+13:00""},""Addresses"":[{""Street"":""\u001farray<address"",""Phone"":""(503) 814-6335"",""Entered"":""2012-02-24T18:55:50.6095676+13:00""},{""Street"":""array 2 address"",""Phone"":""(503) 814-6335"",""Entered"":""2012-02-24T18:55:50.6095676+13:00""}]}";
|
||||||
|
|
||||||
@@ -288,6 +322,12 @@ namespace Newtonsoft.Json.Tests
|
|||||||
await BenchmarkDeserializeMethodAsync<TestClass>(SerializeMethod.JsonNetManualAsync, JsonText);
|
await BenchmarkDeserializeMethodAsync<TestClass>(SerializeMethod.JsonNetManualAsync, JsonText);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task DeserializeIndentedAsync()
|
||||||
|
{
|
||||||
|
await BenchmarkDeserializeMethodAsync<TestClass>(SerializeMethod.JsonNetManualAsync, JsonIndentedText);
|
||||||
|
}
|
||||||
|
|
||||||
public void DeserializeTests<T>(string json)
|
public void DeserializeTests<T>(string json)
|
||||||
{
|
{
|
||||||
BenchmarkDeserializeMethod<T>(SerializeMethod.JavaScriptSerializer, json);
|
BenchmarkDeserializeMethod<T>(SerializeMethod.JavaScriptSerializer, json);
|
||||||
|
|||||||
@@ -138,7 +138,9 @@ namespace Newtonsoft.Json.Tests
|
|||||||
public static void Fail(string message = null, params object[] args)
|
public static void Fail(string message = null, params object[] args)
|
||||||
{
|
{
|
||||||
if (message != null)
|
if (message != null)
|
||||||
|
{
|
||||||
message = message.FormatWith(CultureInfo.InvariantCulture, args);
|
message = message.FormatWith(CultureInfo.InvariantCulture, args);
|
||||||
|
}
|
||||||
|
|
||||||
XAssert.True(false, message);
|
XAssert.True(false, message);
|
||||||
}
|
}
|
||||||
@@ -313,14 +315,16 @@ namespace Newtonsoft.Json.Tests
|
|||||||
Assert.Contains(value, collection, message);
|
Assert.Contains(value, collection, message);
|
||||||
#else
|
#else
|
||||||
if (!collection.Cast<object>().Any(i => i.Equals(value)))
|
if (!collection.Cast<object>().Any(i => i.Equals(value)))
|
||||||
|
{
|
||||||
throw new Exception(message ?? "Value not found in collection.");
|
throw new Exception(message ?? "Value not found in collection.");
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class StringAssert
|
public static class StringAssert
|
||||||
{
|
{
|
||||||
private readonly static Regex Regex = new Regex(@"\r\n|\n\r|\n|\r", RegexOptions.CultureInvariant);
|
private static readonly Regex Regex = new Regex(@"\r\n|\n\r|\n|\r", RegexOptions.CultureInvariant);
|
||||||
|
|
||||||
public static void AreEqual(string expected, string actual)
|
public static void AreEqual(string expected, string actual)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -36,9 +36,9 @@ namespace Newtonsoft.Json.Serialization
|
|||||||
/// The default serialization binder used when resolving and loading classes from type names.
|
/// The default serialization binder used when resolving and loading classes from type names.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class DefaultSerializationBinder :
|
public class DefaultSerializationBinder :
|
||||||
#pragma warning disable CS0618 // Type or member is obsolete
|
#pragma warning disable 618
|
||||||
SerializationBinder,
|
SerializationBinder,
|
||||||
#pragma warning restore CS0618 // Type or member is obsolete
|
#pragma warning restore 618
|
||||||
ISerializationBinder
|
ISerializationBinder
|
||||||
{
|
{
|
||||||
internal static readonly DefaultSerializationBinder Instance = new DefaultSerializationBinder();
|
internal static readonly DefaultSerializationBinder Instance = new DefaultSerializationBinder();
|
||||||
|
|||||||
Reference in New Issue
Block a user