-Added SpecialPropertiesHandling

This commit is contained in:
James Newton-King
2014-02-12 01:43:46 +13:00
parent 71a91bf34f
commit 0f77cd1b03
30 changed files with 659 additions and 128 deletions
@@ -44,6 +44,21 @@ namespace Newtonsoft.Json.Tests.Linq
[TestFixture]
public class JTokenReaderTest : TestFixtureBase
{
[Test]
public void ErrorTokenIndex()
{
JObject json = JObject.Parse(@"{""IntList"":[1, ""two""]}");
ExceptionAssert.Throws<Exception>(
"Could not convert string to integer: two. Path 'IntList[1]', line 1, position 20.",
() =>
{
JsonSerializer serializer = new JsonSerializer();
serializer.Deserialize<TraceTestObject>(json.CreateReader());
});
}
#if !NET20
[Test]
public void YahooFinance()
@@ -49,6 +49,24 @@ namespace Newtonsoft.Json.Tests.Linq
[TestFixture]
public class LinqToJsonTest : TestFixtureBase
{
[Test]
public void JPropertyPath()
{
JObject o = new JObject
{
{
"person",
new JObject
{
{ "$id", 1 }
}
}
};
JContainer idProperty = o["person"]["$id"].Parent;
Assert.AreEqual("person.$id", idProperty.Path);
}
[Test]
public void ForEach()
{