コード例 #1
0
        public void GetNormalized_ReturnsSelf()
        {
            var element = new JsonPathExpressionElement("@.length-1");

            var actual = element.GetNormalized();

            actual.Should().Be(element);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        public void IsNormalized_ReturnsTrue()
        {
            var element = new JsonPathExpressionElement("@.length-1");

            element.IsNormalized.Should().BeTrue();
        }
コード例 #7
0
        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(")]");
 }