-Added additional frameworks to project.json files
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#if NET20
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#else
|
||||
using System.Linq;
|
||||
#endif
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json.Linq;
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
@@ -257,6 +260,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
Assert.AreEqual(new Uri("http://www.google.com/"), i);
|
||||
}
|
||||
|
||||
#if !NET20
|
||||
[Test]
|
||||
public void Example()
|
||||
{
|
||||
@@ -280,5 +284,6 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
|
||||
Assert.AreEqual(2, changedProperties.Count);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -82,6 +82,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
}
|
||||
}
|
||||
|
||||
#if !NETFX_CORE
|
||||
private void UpdateValueCount(IDictionary<string, int> counts, dynamic d)
|
||||
{
|
||||
string s = d.ToString();
|
||||
@@ -96,7 +97,6 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
counts[s] = c;
|
||||
}
|
||||
|
||||
#if !NETFX_CORE
|
||||
[Test]
|
||||
public void DeserializeLargeDynamic()
|
||||
{
|
||||
|
||||
@@ -221,5 +221,28 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
|
||||
ExceptionAssert.Throws<JsonException>(() => { t.Add(1); }, "Newtonsoft.Json.Linq.JProperty cannot have multiple values.");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NullParent()
|
||||
{
|
||||
var json = @"{
|
||||
""prop1"": {
|
||||
""foo"": ""bar""
|
||||
},
|
||||
}";
|
||||
|
||||
var obj = JsonConvert.DeserializeObject<JObject>(json);
|
||||
|
||||
var property = obj.Property("prop1");
|
||||
var value = property.Value;
|
||||
|
||||
// remove value so it has no parent
|
||||
property.Value = null;
|
||||
|
||||
property.Remove();
|
||||
obj.Add(new JProperty("prop2", value));
|
||||
|
||||
Assert.AreEqual(((JProperty)value.Parent).Name, "prop2");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user