Adds test for deserializing XmlElement and a minor change in the exception message

This commit is contained in:
Jack Ma
2016-04-22 11:00:11 -07:00
parent 795b9e3a46
commit 096b8f3576
2 changed files with 18 additions and 1 deletions
@@ -906,6 +906,23 @@ namespace Newtonsoft.Json.Tests.Converters
return sw.ToString();
}
public class Foo2
{
public XmlElement Bar { get; set; }
}
[Test]
public void SerializeAndDeserializeXmlElement()
{
Foo2 foo = new Foo2 { Bar = null };
string json = JsonConvert.SerializeObject(foo);
Assert.AreEqual(@"{""Bar"":null}", json);
Foo2 foo2 = JsonConvert.DeserializeObject<Foo2>(json);
Assert.IsNull(foo2.Bar);
}
[Test]
public void SingleTextNode()
{