Skip to content

Commit

Permalink
-Typo
Browse files Browse the repository at this point in the history
-Test
  • Loading branch information
JamesNK committed Mar 4, 2018
1 parent 5982f1c commit a33222f
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public void ReadingAndWritingJsonText()
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();
}
Expand All @@ -85,7 +85,7 @@ public void ReadingAndWritingJsonText()
// "DVD read/writer"
// /*(broken)*/,
// "500 gigabyte hard drive",
// "200 gigabype hard drive"
// "200 gigabyte hard drive"
// ]
// }
#endregion
Expand All @@ -102,7 +102,7 @@ public void ReadingJsonText()
'DVD read/writer'
/*(broken)*/,
'500 gigabyte hard drive',
'200 gigabype hard drive'
'200 gigabyte hard drive'
]
}";

Expand All @@ -129,7 +129,7 @@ public void ReadingJsonText()
// 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void Example()
'DVD read/writer'
/*(broken)*/,
'500 gigabyte hard drive',
'200 gigabype hard drive'
'200 gigabyte hard drive'
]
}";

Expand All @@ -79,7 +79,7 @@ public void Example()
// 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void Example()
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();
}
Expand All @@ -75,7 +75,7 @@ public void Example()
// "DVD read/writer"
// /*(broken)*/,
// "500 gigabyte hard drive",
// "200 gigabype hard drive"
// "200 gigabyte hard drive"
// ]
// }
#endregion
Expand All @@ -87,7 +87,7 @@ public void Example()
""DVD read/writer""
/*(broken)*/,
""500 gigabyte hard drive"",
""200 gigabype hard drive""
""200 gigabyte hard drive""
]
}", sb.ToString());
}
Expand Down
57 changes: 57 additions & 0 deletions Src/Newtonsoft.Json.Tests/Issues/Issue1353.cs
Original file line number Diff line number Diff line change
@@ -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
14 changes: 7 additions & 7 deletions Src/Newtonsoft.Json.Tests/JsonTextWriterAsyncTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ public async Task WriteEndAsync()
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);
}
Expand All @@ -547,7 +547,7 @@ public async Task WriteEndAsync()
""DVD read/writer""
/*(broken)*/,
""500 gigabyte hard drive"",
""200 gigabype hard drive""
""200 gigabyte hard drive""
]
}";
string result = sb.ToString();
Expand Down Expand Up @@ -575,7 +575,7 @@ public async Task CloseWithRemainingContentAsync()
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();
}

Expand All @@ -586,7 +586,7 @@ public async Task CloseWithRemainingContentAsync()
""DVD read/writer""
/*(broken)*/,
""500 gigabyte hard drive"",
""200 gigabype hard drive""
""200 gigabyte hard drive""
]
}";
string result = sb.ToString();
Expand Down Expand Up @@ -614,7 +614,7 @@ public async Task IndentingAsync()
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);
Expand All @@ -627,7 +627,7 @@ public async Task IndentingAsync()
// "DVD read/writer"
// /*(broken)*/,
// "500 gigabyte hard drive",
// "200 gigabype hard drive"
// "200 gigabyte hard drive"
// ]
// }

Expand All @@ -638,7 +638,7 @@ public async Task IndentingAsync()
""DVD read/writer""
/*(broken)*/,
""500 gigabyte hard drive"",
""200 gigabype hard drive""
""200 gigabyte hard drive""
]
}";
string result = sb.ToString();
Expand Down
14 changes: 7 additions & 7 deletions Src/Newtonsoft.Json.Tests/JsonTextWriterTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ public void WriteEnd()
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);
}
Expand All @@ -410,7 +410,7 @@ public void WriteEnd()
""DVD read/writer""
/*(broken)*/,
""500 gigabyte hard drive"",
""200 gigabype hard drive""
""200 gigabyte hard drive""
]
}";
string result = sb.ToString();
Expand Down Expand Up @@ -438,7 +438,7 @@ public void CloseWithRemainingContent()
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();
}

Expand All @@ -449,7 +449,7 @@ public void CloseWithRemainingContent()
""DVD read/writer""
/*(broken)*/,
""500 gigabyte hard drive"",
""200 gigabype hard drive""
""200 gigabyte hard drive""
]
}";
string result = sb.ToString();
Expand Down Expand Up @@ -477,7 +477,7 @@ public void Indenting()
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);
Expand All @@ -490,7 +490,7 @@ public void Indenting()
// "DVD read/writer"
// /*(broken)*/,
// "500 gigabyte hard drive",
// "200 gigabype hard drive"
// "200 gigabyte hard drive"
// ]
// }

Expand All @@ -501,7 +501,7 @@ public void Indenting()
""DVD read/writer""
/*(broken)*/,
""500 gigabyte hard drive"",
""200 gigabype hard drive""
""200 gigabyte hard drive""
]
}";
string result = sb.ToString();
Expand Down

0 comments on commit a33222f

Please sign in to comment.