-Fixed unhelpful error message when deserializing badly formatted regex string

This commit is contained in:
James Newton-King
2018-02-17 21:07:07 +13:00
parent 31b1d7a690
commit 41c3a71e62
4 changed files with 83 additions and 26 deletions
@@ -534,11 +534,11 @@ namespace Newtonsoft.Json.Tests.Serialization
string iPersonJson = JsonConvert.SerializeObject(employee, Formatting.Indented,
new JsonSerializerSettings { ContractResolver = new IPersonContractResolver() });
StringAssert.AreEqual(@"{
""FirstName"": ""Maurice"",
""LastName"": ""Moss"",
""BirthDate"": ""1977-12-30T01:01:01Z""
}", iPersonJson);
JObject o = JObject.Parse(iPersonJson);
Assert.AreEqual("Maurice", (string)o["FirstName"]);
Assert.AreEqual("Moss", (string)o["LastName"]);
Assert.AreEqual(new DateTime(1977, 12, 30, 1, 1, 1, DateTimeKind.Utc), (DateTime)o["BirthDate"]);
}
[Test]