Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/Newtonsoft.Json.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'Src/Newtonsoft.Json.Tests/Linq/JPathTests.cs')
-rw-r--r--Src/Newtonsoft.Json.Tests/Linq/JPathTests.cs35
1 files changed, 32 insertions, 3 deletions
diff --git a/Src/Newtonsoft.Json.Tests/Linq/JPathTests.cs b/Src/Newtonsoft.Json.Tests/Linq/JPathTests.cs
index 1d699a5..08031be 100644
--- a/Src/Newtonsoft.Json.Tests/Linq/JPathTests.cs
+++ b/Src/Newtonsoft.Json.Tests/Linq/JPathTests.cs
@@ -181,8 +181,8 @@ namespace Newtonsoft.Json.Tests.Linq
}
[Test]
- [ExpectedException(typeof(Exception), ExpectedMessage = @"Index 1 not valid on JConstructor.")]
- public void EvaluateIndexerOnConstructorWithError()
+ [ExpectedException(typeof(IndexOutOfRangeException), ExpectedMessage = @"Index 1 outside the bounds of JConstructor.")]
+ public void EvaluateConstructorOutOfBoundsIndxerWithError()
{
JConstructor c = new JConstructor("Blah");
@@ -210,7 +210,7 @@ namespace Newtonsoft.Json.Tests.Linq
[Test]
[ExpectedException(typeof(IndexOutOfRangeException), ExpectedMessage = "Index 1000 outside the bounds of JArray.")]
- public void EvaluateOutOfBoundsIndxerWithError()
+ public void EvaluateArrayOutOfBoundsIndxerWithError()
{
JArray a = new JArray(1, 2, 3, 4, 5);
@@ -253,6 +253,35 @@ namespace Newtonsoft.Json.Tests.Linq
}
[Test]
+ public void PathWithConstructor()
+ {
+ JArray a = JArray.Parse(@"[
+ {
+ ""Property1"": [
+ 1,
+ [
+ [
+ []
+ ]
+ ]
+ ]
+ },
+ {
+ ""Property2"": new Constructor1(
+ null,
+ [
+ 1
+ ]
+ )
+ }
+]");
+
+ JValue v = (JValue)a.SelectToken("[1].Property2[1][0]");
+ Assert.AreEqual(1, v.Value);
+ }
+
+
+ [Test]
public void Example()
{
JObject o = JObject.Parse(@"{