-Fixed error when writing JSON for a JProperty with no value

-LINQ to JSON performance improvements
This commit is contained in:
James Newton-King
2012-08-11 20:12:49 +12:00
parent 7359433dc7
commit f5fec30c2a
6 changed files with 78 additions and 29 deletions
+13 -2
View File
@@ -52,6 +52,17 @@ namespace Newtonsoft.Json.Tests.Linq
[TestFixture]
public class JObjectTests : TestFixtureBase
{
[Test]
public void WritePropertyWithNoValue()
{
var o = new JObject();
o.Add(new JProperty("novalue"));
Assert.AreEqual(@"{
""novalue"": null
}", o.ToString());
}
[Test]
public void Keys()
{
@@ -1360,7 +1371,7 @@ Parameter name: arrayIndex",
public void IBindingListAddNewWithEvent()
{
JObject o = new JObject();
o.AddingNew += (s, e) => e.NewObject = new JProperty("Property!");
o._addingNew += (s, e) => e.NewObject = new JProperty("Property!");
IBindingList l = o;
object newObject = l.AddNew();
@@ -1441,7 +1452,7 @@ Parameter name: arrayIndex",
NotifyCollectionChangedAction? changedType = null;
int? index = null;
o.CollectionChanged += (s, a) =>
o._collectionChanged += (s, a) =>
{
changedType = a.Action;
index = a.NewStartingIndex;