Clean up DuplicatePropertyNameHandling feature

This commit is contained in:
James Newton-King
2018-11-24 21:25:20 +13:00
parent a1f1b0aa86
commit 88dae52165
10 changed files with 132 additions and 49 deletions
@@ -1604,6 +1604,37 @@ Parameter name: arrayIndex");
Assert.AreEqual("Name2", value);
}
[Test]
public void ParseMultipleProperties_EmptySettings()
{
string json = @"{
""Name"": ""Name1"",
""Name"": ""Name2""
}";
JObject o = JObject.Parse(json, new JsonLoadSettings());
string value = (string)o["Name"];
Assert.AreEqual("Name2", value);
}
[Test]
public void ParseMultipleProperties_IgnoreDuplicateSetting()
{
string json = @"{
""Name"": ""Name1"",
""Name"": ""Name2""
}";
JObject o = JObject.Parse(json, new JsonLoadSettings
{
DuplicatePropertyNameHandling = DuplicatePropertyNameHandling.Ignore
});
string value = (string)o["Name"];
Assert.AreEqual("Name1", value);
}
#if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD2_0
[Test]
public void WriteObjectNullDBNullValue()