public void GetNormalized_ReturnsSelf()
        {
            var element = new JsonPathExpressionElement("@.length-1");

            var actual = element.GetNormalized();

            actual.Should().Be(element);
        }
        public void Matches_ArraySlice(string expression, int?start, int?end, int step, bool?expected)
        {
            var element = new JsonPathExpressionElement(expression);
            var other   = new JsonPathArraySliceElement(start, end, step);

            bool?actual = element.Matches(other);

            actual.Should().Be(expected);
        }
        public void Matches_ArrayIndexList(string expression, int indexCount, bool?expected)
        {
            var element = new JsonPathExpressionElement(expression);
            var other   = new JsonPathArrayIndexListElement(Enumerable.Range(0, indexCount).ToList());

            bool?actual = element.Matches(other);

            actual.Should().Be(expected);
        }
        public void Matches_Expression(string expression, string otherExpression, bool expected)
        {
            var element = new JsonPathExpressionElement(expression);
            var other   = new JsonPathExpressionElement(otherExpression);

            bool?actual = element.Matches(other);

            actual.Should().Be(expected);
        }
        public void Matches_Any(JsonPathElementType type, bool?expected)
        {
            var element = new JsonPathExpressionElement("@.length-1");
            var other   = ElementCreator.CreateAny(type);

            bool?actual = element.Matches(other);

            actual.Should().Be(expected);
        }
        public void IsNormalized_ReturnsTrue()
        {
            var element = new JsonPathExpressionElement("@.length-1");

            element.IsNormalized.Should().BeTrue();
        }
        public void IsStrict_ReturnsFalse()
        {
            var element = new JsonPathExpressionElement("@.length-1");

            element.IsStrict.Should().BeFalse();
        }
示例#8
0
 private static void AppendExpression(this StringBuilder builder, JsonPathExpressionElement element)
 {
     builder.Append("[(");
     builder.Append(element.Expression);
     builder.Append(")]");
 }