public void GetNormalized_ReturnsSelf()
        {
            var element = new JsonPathArrayIndexElement(7);

            var actual = element.GetNormalized();

            actual.Should().Be(element);
        }
        public void Matches_UnknownArrayIndexList_ReturnsFalse()
        {
            var element = new JsonPathArrayIndexElement(7);
            var other   = new JsonPathArrayIndexListElement(new[] { 0, 7 });

            bool?actual = element.Matches(other);

            actual.Should().BeFalse();
        }
        public void Matches_KnownArrayIndex_ReturnsTrue()
        {
            var element = new JsonPathArrayIndexElement(7);
            var other   = new JsonPathArrayIndexElement(7);

            bool?actual = element.Matches(other);

            actual.Should().BeTrue();
        }
        public void Matches_Any_ReturnsFalse(JsonPathElementType type)
        {
            var element = new JsonPathArrayIndexElement(7);
            var other   = ElementCreator.CreateAny(type);

            bool?actual = element.Matches(other);

            actual.Should().BeFalse();
        }
        public void Matches_ArraySlice(int index, int?start, int?end, int step, bool?expected)
        {
            var element = new JsonPathArrayIndexElement(index);
            var other   = new JsonPathArraySliceElement(start, end, step);

            bool?actual = element.Matches(other);

            actual.Should().Be(expected);
        }
        public void GetNormalized_SingleIndex_ReturnsArrayIndexElement()
        {
            var element  = new JsonPathArraySliceElement(42, 43, 7);
            var expected = new JsonPathArrayIndexElement(42);

            var actual = element.GetNormalized();

            actual.Should().BeEquivalentTo(expected);
        }
        public void IsNormalized_ReturnsTrue()
        {
            var element = new JsonPathArrayIndexElement(7);

            element.IsNormalized.Should().BeTrue();
        }
        public void IsStrict_ReturnsTrue()
        {
            var element = new JsonPathArrayIndexElement(7);

            element.IsStrict.Should().BeTrue();
        }
Example #9
0
 private static void AppendArrayIndex(this StringBuilder builder, JsonPathArrayIndexElement element)
 {
     builder.Append('[');
     builder.Append(element.Index);
     builder.Append(']');
 }