-Improved Portable40 assembly performance by using compiled expression reflection

-Fixed converting string JValues to enums with JToken.ToObject
This commit is contained in:
James Newton-King
2014-08-24 23:33:08 +12:00
parent dce6228b8f
commit 57ccaf00bf
15 changed files with 125 additions and 21 deletions
@@ -137,8 +137,45 @@ namespace Newtonsoft.Json.Tests.Converters
Assert.IsNull(foo2.Bar);
}
[Test]
public void MultipleNamespacesXDocument()
{
string xml = @"<result xp_0:end=""2014-08-15 13:12:11.9184"" xp_0:start=""2014-08-15 13:11:49.3140"" xp_0:time_diff=""22604.3836"" xmlns:xp_0=""Test1"" p2:end=""2014-08-15 13:13:49.5522"" p2:start=""2014-08-15 13:13:49.0268"" p2:time_diff=""525.4646"" xmlns:p2=""Test2"" />";
XDocument d = XDocument.Parse(xml);
string json = JsonConvert.SerializeObject(d, Formatting.Indented);
Console.WriteLine(json);
XDocument doc = JsonConvert.DeserializeObject<XDocument>(json);
Console.WriteLine(doc.ToString());
Assert.AreEqual(xml, doc.ToString());
}
#endif
[Test]
public void MultipleNamespacesXmlDocument()
{
string xml = @"<result xp_0:end=""2014-08-15 13:12:11.9184"" xp_0:start=""2014-08-15 13:11:49.3140"" xp_0:time_diff=""22604.3836"" xmlns:xp_0=""Test1"" p2:end=""2014-08-15 13:13:49.5522"" p2:start=""2014-08-15 13:13:49.0268"" p2:time_diff=""525.4646"" xmlns:p2=""Test2"" />";
XmlDocument d = new XmlDocument();
d.LoadXml(xml);
string json = JsonConvert.SerializeObject(d, Formatting.Indented);
Console.WriteLine(json);
XmlDocument doc = JsonConvert.DeserializeObject<XmlDocument>(json);
Console.WriteLine(doc.OuterXml);
Assert.AreEqual(xml, doc.OuterXml);
}
[Test]
public void SerializeXmlElement()
{