initial commit issue #931 fix

This commit is contained in:
Антон
2018-11-24 21:25:20 +13:00
committed by James Newton-King
parent c6e4ca7a94
commit a1f1b0aa86
6 changed files with 121 additions and 2 deletions
@@ -1752,7 +1752,29 @@ third line", jsonTextReader.Value);
Assert.IsTrue(reader.ReadAsInt32Async(token).IsCanceled);
Assert.IsTrue(reader.ReadAsStringAsync(token).IsCanceled);
}
}
}
[Test]
public async Task ThrowOnDuplicateKeysDeserializingAsync()
{
string json = @"
{
""a"": 1,
""b"": [
{
""c"": {
""d"": 1,
""d"": ""2""
}
}
]
}
";
JsonLoadSettings settings = new JsonLoadSettings { DuplicatePropertyNamesHandling = DuplicatePropertyNamesHandling.Throw };
JsonTextReader reader = new JsonTextReader(new StringReader(json));
await ExceptionAssert.ThrowsAsync<JsonException>( async () => await JToken.ReadFromAsync(reader, settings));
}
}
}
#endif