-Test
This commit is contained in:
James Newton-King
2018-03-05 12:50:01 +13:00
parent 5982f1c514
commit a33222f71d
6 changed files with 80 additions and 23 deletions
@@ -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
@@ -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
@@ -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());
}
@@ -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<string, string> d1 = new ConcurrentDictionary<string, string>();
d1.TryAdd("key!", "value!");
string json = JsonConvert.SerializeObject(d1, Formatting.Indented);
ConcurrentDictionary<string, string> d2 = JsonConvert.DeserializeObject<ConcurrentDictionary<string, string>>(json);
Assert.AreEqual(1, d2.Count);
Assert.AreEqual("value!", d2["key!"]);
}
}
}
#endif
@@ -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();
@@ -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();