public void ObjectNameLengthExpression_LastItem()
        {
            var json = new JsonObject
            {
                { "name", new JsonArray {
                      1, 2, 3
                  } },
                { "name2", new JsonArray {
                      1, 2, 3
                  } },
                { "test", new JsonArray {
                      1, 2
                  } },
            };
            var path     = JsonPathWith.Array(jv => JsonPathRoot.Name("test").Length());
            var expected = new JsonArray {
                new JsonArray {
                    1, 2
                }
            };

            var actual = path.Evaluate(json);

            Assert.AreEqual(expected, actual);
        }
Exemple #2
0
 public void ArrayFilterExpression_RootLengthNotEqualsValue()
 {
     Run("$[?($.length != 1)]", JsonPathWith.Array(jv => JsonPathRoot.Length() != 1));
 }
Exemple #3
0
 public void ArrayIndexExpression_RootLength()
 {
     Run("$[($.length)]", JsonPathWith.Array(jv => JsonPathRoot.Length()));
 }
Exemple #4
0
 public void WhyOnGodsGreenEarthWouldAnyoneDoThis()
 {
     _Run(JsonPathWith.Array(jv => 4 + jv.Length() * (JsonPathRoot.Name("name").Length() - 2) + 5),
          "$[([email protected]*($.name.length-2)+5)]");
 }
Exemple #5
0
 public void Length_Root()
 {
     _Run(JsonPathWith.Array(jv => JsonPathRoot.Length()), "$[($.length)]");
 }