diff --git a/Src/Newtonsoft.Json.Tests/PerformanceTests.cs b/Src/Newtonsoft.Json.Tests/PerformanceTests.cs index bde64843..af72bf90 100644 --- a/Src/Newtonsoft.Json.Tests/PerformanceTests.cs +++ b/Src/Newtonsoft.Json.Tests/PerformanceTests.cs @@ -87,6 +87,40 @@ namespace Newtonsoft.Json.Tests 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<[, (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<[, (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(SerializeMethod.JsonNetManualAsync, JsonText); } + [Test] + public async Task DeserializeIndentedAsync() + { + await BenchmarkDeserializeMethodAsync(SerializeMethod.JsonNetManualAsync, JsonIndentedText); + } + public void DeserializeTests(string json) { BenchmarkDeserializeMethod(SerializeMethod.JavaScriptSerializer, json); diff --git a/Src/Newtonsoft.Json.Tests/TestFixtureBase.cs b/Src/Newtonsoft.Json.Tests/TestFixtureBase.cs index 35eeabfd..0de72507 100644 --- a/Src/Newtonsoft.Json.Tests/TestFixtureBase.cs +++ b/Src/Newtonsoft.Json.Tests/TestFixtureBase.cs @@ -138,7 +138,9 @@ namespace Newtonsoft.Json.Tests public static void Fail(string message = null, params object[] args) { if (message != null) + { message = message.FormatWith(CultureInfo.InvariantCulture, args); + } XAssert.True(false, message); } @@ -313,14 +315,16 @@ namespace Newtonsoft.Json.Tests Assert.Contains(value, collection, message); #else if (!collection.Cast().Any(i => i.Equals(value))) + { throw new Exception(message ?? "Value not found in collection."); + } #endif } } 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) { diff --git a/Src/Newtonsoft.Json/Serialization/DefaultSerializationBinder.cs b/Src/Newtonsoft.Json/Serialization/DefaultSerializationBinder.cs index 1b84e74c..b43e4b0b 100644 --- a/Src/Newtonsoft.Json/Serialization/DefaultSerializationBinder.cs +++ b/Src/Newtonsoft.Json/Serialization/DefaultSerializationBinder.cs @@ -36,9 +36,9 @@ namespace Newtonsoft.Json.Serialization /// The default serialization binder used when resolving and loading classes from type names. /// public class DefaultSerializationBinder : -#pragma warning disable CS0618 // Type or member is obsolete +#pragma warning disable 618 SerializationBinder, -#pragma warning restore CS0618 // Type or member is obsolete +#pragma warning restore 618 ISerializationBinder { internal static readonly DefaultSerializationBinder Instance = new DefaultSerializationBinder();