diff --git a/Src/Newtonsoft.Json.Tests/Documentation/ReadingAndWritingJsonTests.cs b/Src/Newtonsoft.Json.Tests/Documentation/ReadingAndWritingJsonTests.cs index 9935a9d3..f01b1938 100644 --- a/Src/Newtonsoft.Json.Tests/Documentation/ReadingAndWritingJsonTests.cs +++ b/Src/Newtonsoft.Json.Tests/Documentation/ReadingAndWritingJsonTests.cs @@ -73,7 +73,7 @@ namespace Newtonsoft.Json.Tests.Documentation writer.WriteValue("DVD read/writer"); writer.WriteComment("(broken)"); writer.WriteValue("500 gigabyte hard drive"); - writer.WriteValue("200 gigabype hard drive"); + writer.WriteValue("200 gigabyte hard drive"); writer.WriteEnd(); writer.WriteEndObject(); } @@ -85,7 +85,7 @@ namespace Newtonsoft.Json.Tests.Documentation // "DVD read/writer" // /*(broken)*/, // "500 gigabyte hard drive", - // "200 gigabype hard drive" + // "200 gigabyte hard drive" // ] // } #endregion @@ -102,7 +102,7 @@ namespace Newtonsoft.Json.Tests.Documentation 'DVD read/writer' /*(broken)*/, '500 gigabyte hard drive', - '200 gigabype hard drive' + '200 gigabyte hard drive' ] }"; @@ -129,7 +129,7 @@ namespace Newtonsoft.Json.Tests.Documentation // Token: String, Value: DVD read/writer // Token: Comment, Value: (broken) // Token: String, Value: 500 gigabyte hard drive - // Token: String, Value: 200 gigabype hard drive + // Token: String, Value: 200 gigabyte hard drive // Token: EndArray // Token: EndObject #endregion diff --git a/Src/Newtonsoft.Json.Tests/Documentation/Samples/Json/ReadJsonWithJsonTextReader.cs b/Src/Newtonsoft.Json.Tests/Documentation/Samples/Json/ReadJsonWithJsonTextReader.cs index 1e64b50c..f07dfe04 100644 --- a/Src/Newtonsoft.Json.Tests/Documentation/Samples/Json/ReadJsonWithJsonTextReader.cs +++ b/Src/Newtonsoft.Json.Tests/Documentation/Samples/Json/ReadJsonWithJsonTextReader.cs @@ -52,7 +52,7 @@ namespace Newtonsoft.Json.Tests.Documentation.Samples.Json 'DVD read/writer' /*(broken)*/, '500 gigabyte hard drive', - '200 gigabype hard drive' + '200 gigabyte hard drive' ] }"; @@ -79,7 +79,7 @@ namespace Newtonsoft.Json.Tests.Documentation.Samples.Json // Token: String, Value: DVD read/writer // Token: Comment, Value: (broken) // Token: String, Value: 500 gigabyte hard drive - // Token: String, Value: 200 gigabype hard drive + // Token: String, Value: 200 gigabyte hard drive // Token: EndArray // Token: EndObject #endregion diff --git a/Src/Newtonsoft.Json.Tests/Documentation/Samples/Json/WriteJsonWithJsonTextWriter.cs b/Src/Newtonsoft.Json.Tests/Documentation/Samples/Json/WriteJsonWithJsonTextWriter.cs index 75ecefa6..b3a8d283 100644 --- a/Src/Newtonsoft.Json.Tests/Documentation/Samples/Json/WriteJsonWithJsonTextWriter.cs +++ b/Src/Newtonsoft.Json.Tests/Documentation/Samples/Json/WriteJsonWithJsonTextWriter.cs @@ -62,7 +62,7 @@ namespace Newtonsoft.Json.Tests.Documentation.Samples.Json writer.WriteValue("DVD read/writer"); writer.WriteComment("(broken)"); writer.WriteValue("500 gigabyte hard drive"); - writer.WriteValue("200 gigabype hard drive"); + writer.WriteValue("200 gigabyte hard drive"); writer.WriteEnd(); writer.WriteEndObject(); } @@ -75,7 +75,7 @@ namespace Newtonsoft.Json.Tests.Documentation.Samples.Json // "DVD read/writer" // /*(broken)*/, // "500 gigabyte hard drive", - // "200 gigabype hard drive" + // "200 gigabyte hard drive" // ] // } #endregion @@ -87,7 +87,7 @@ namespace Newtonsoft.Json.Tests.Documentation.Samples.Json ""DVD read/writer"" /*(broken)*/, ""500 gigabyte hard drive"", - ""200 gigabype hard drive"" + ""200 gigabyte hard drive"" ] }", sb.ToString()); } diff --git a/Src/Newtonsoft.Json.Tests/Issues/Issue1353.cs b/Src/Newtonsoft.Json.Tests/Issues/Issue1353.cs new file mode 100644 index 00000000..4a8d3306 --- /dev/null +++ b/Src/Newtonsoft.Json.Tests/Issues/Issue1353.cs @@ -0,0 +1,57 @@ +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +#if !(NET20 || NET35) +using System; +using System.Collections.Concurrent; +#if DNXCORE50 +using Xunit; +using Test = Xunit.FactAttribute; +using Assert = Newtonsoft.Json.Tests.XUnitAssert; +#else +using NUnit.Framework; +#endif + +namespace Newtonsoft.Json.Tests.Issues +{ + [TestFixture] + public class Issue1353 : TestFixtureBase + { + [Test] + public void Test() + { + ConcurrentDictionary d1 = new ConcurrentDictionary(); + d1.TryAdd("key!", "value!"); + + string json = JsonConvert.SerializeObject(d1, Formatting.Indented); + + ConcurrentDictionary d2 = JsonConvert.DeserializeObject>(json); + + Assert.AreEqual(1, d2.Count); + Assert.AreEqual("value!", d2["key!"]); + } + } +} +#endif \ No newline at end of file diff --git a/Src/Newtonsoft.Json.Tests/JsonTextWriterAsyncTests.cs b/Src/Newtonsoft.Json.Tests/JsonTextWriterAsyncTests.cs index 4e4dc1e5..11b111dc 100644 --- a/Src/Newtonsoft.Json.Tests/JsonTextWriterAsyncTests.cs +++ b/Src/Newtonsoft.Json.Tests/JsonTextWriterAsyncTests.cs @@ -535,7 +535,7 @@ namespace Newtonsoft.Json.Tests await jsonWriter.WriteValueAsync("DVD read/writer"); await jsonWriter.WriteCommentAsync("(broken)"); await jsonWriter.WriteValueAsync("500 gigabyte hard drive"); - await jsonWriter.WriteValueAsync("200 gigabype hard drive"); + await jsonWriter.WriteValueAsync("200 gigabyte hard drive"); await jsonWriter.WriteEndObjectAsync(); Assert.AreEqual(WriteState.Start, jsonWriter.WriteState); } @@ -547,7 +547,7 @@ namespace Newtonsoft.Json.Tests ""DVD read/writer"" /*(broken)*/, ""500 gigabyte hard drive"", - ""200 gigabype hard drive"" + ""200 gigabyte hard drive"" ] }"; string result = sb.ToString(); @@ -575,7 +575,7 @@ namespace Newtonsoft.Json.Tests await jsonWriter.WriteValueAsync("DVD read/writer"); await jsonWriter.WriteCommentAsync("(broken)"); await jsonWriter.WriteValueAsync("500 gigabyte hard drive"); - await jsonWriter.WriteValueAsync("200 gigabype hard drive"); + await jsonWriter.WriteValueAsync("200 gigabyte hard drive"); await jsonWriter.CloseAsync(); } @@ -586,7 +586,7 @@ namespace Newtonsoft.Json.Tests ""DVD read/writer"" /*(broken)*/, ""500 gigabyte hard drive"", - ""200 gigabype hard drive"" + ""200 gigabyte hard drive"" ] }"; string result = sb.ToString(); @@ -614,7 +614,7 @@ namespace Newtonsoft.Json.Tests await jsonWriter.WriteValueAsync("DVD read/writer"); await jsonWriter.WriteCommentAsync("(broken)"); await jsonWriter.WriteValueAsync("500 gigabyte hard drive"); - await jsonWriter.WriteValueAsync("200 gigabype hard drive"); + await jsonWriter.WriteValueAsync("200 gigabyte hard drive"); await jsonWriter.WriteEndAsync(); await jsonWriter.WriteEndObjectAsync(); Assert.AreEqual(WriteState.Start, jsonWriter.WriteState); @@ -627,7 +627,7 @@ namespace Newtonsoft.Json.Tests // "DVD read/writer" // /*(broken)*/, // "500 gigabyte hard drive", - // "200 gigabype hard drive" + // "200 gigabyte hard drive" // ] // } @@ -638,7 +638,7 @@ namespace Newtonsoft.Json.Tests ""DVD read/writer"" /*(broken)*/, ""500 gigabyte hard drive"", - ""200 gigabype hard drive"" + ""200 gigabyte hard drive"" ] }"; string result = sb.ToString(); diff --git a/Src/Newtonsoft.Json.Tests/JsonTextWriterTest.cs b/Src/Newtonsoft.Json.Tests/JsonTextWriterTest.cs index a8d1f469..a004e738 100644 --- a/Src/Newtonsoft.Json.Tests/JsonTextWriterTest.cs +++ b/Src/Newtonsoft.Json.Tests/JsonTextWriterTest.cs @@ -398,7 +398,7 @@ namespace Newtonsoft.Json.Tests jsonWriter.WriteValue("DVD read/writer"); jsonWriter.WriteComment("(broken)"); jsonWriter.WriteValue("500 gigabyte hard drive"); - jsonWriter.WriteValue("200 gigabype hard drive"); + jsonWriter.WriteValue("200 gigabyte hard drive"); jsonWriter.WriteEndObject(); Assert.AreEqual(WriteState.Start, jsonWriter.WriteState); } @@ -410,7 +410,7 @@ namespace Newtonsoft.Json.Tests ""DVD read/writer"" /*(broken)*/, ""500 gigabyte hard drive"", - ""200 gigabype hard drive"" + ""200 gigabyte hard drive"" ] }"; string result = sb.ToString(); @@ -438,7 +438,7 @@ namespace Newtonsoft.Json.Tests jsonWriter.WriteValue("DVD read/writer"); jsonWriter.WriteComment("(broken)"); jsonWriter.WriteValue("500 gigabyte hard drive"); - jsonWriter.WriteValue("200 gigabype hard drive"); + jsonWriter.WriteValue("200 gigabyte hard drive"); jsonWriter.Close(); } @@ -449,7 +449,7 @@ namespace Newtonsoft.Json.Tests ""DVD read/writer"" /*(broken)*/, ""500 gigabyte hard drive"", - ""200 gigabype hard drive"" + ""200 gigabyte hard drive"" ] }"; string result = sb.ToString(); @@ -477,7 +477,7 @@ namespace Newtonsoft.Json.Tests jsonWriter.WriteValue("DVD read/writer"); jsonWriter.WriteComment("(broken)"); jsonWriter.WriteValue("500 gigabyte hard drive"); - jsonWriter.WriteValue("200 gigabype hard drive"); + jsonWriter.WriteValue("200 gigabyte hard drive"); jsonWriter.WriteEnd(); jsonWriter.WriteEndObject(); Assert.AreEqual(WriteState.Start, jsonWriter.WriteState); @@ -490,7 +490,7 @@ namespace Newtonsoft.Json.Tests // "DVD read/writer" // /*(broken)*/, // "500 gigabyte hard drive", - // "200 gigabype hard drive" + // "200 gigabyte hard drive" // ] // } @@ -501,7 +501,7 @@ namespace Newtonsoft.Json.Tests ""DVD read/writer"" /*(broken)*/, ""500 gigabyte hard drive"", - ""200 gigabype hard drive"" + ""200 gigabyte hard drive"" ] }"; string result = sb.ToString();