public void Matches(string pathInSet, string path, bool?expected)
        {
            var matchingSet = new JsonPathExpressionMatchingSet <JsonPathExpression>();

            matchingSet.Add(new JsonPathExpression(pathInSet));

            bool?actual = matchingSet.Matches(new JsonPathExpression(path));

            actual.Should().Be(expected);
        }
        public void Matches_PossiblyMatchesBySliceAndMatchesByRecursiveDescent_ReturnsTrue()
        {
            var matchingSet = new JsonPathExpressionMatchingSet <JsonPathExpression>
            {
                new JsonPathExpression("$.a[-1:].b[*]"),
                new JsonPathExpression("$..b[*]")
            };

            bool?actual = matchingSet.Matches(new JsonPathExpression("$.a[7].b[42]"));

            actual.Should().BeTrue();
        }
        public void Matches_ReturnsMatched()
        {
            var matchingSet = new JsonPathExpressionMatchingSet <JsonPathExpression>
            {
                new JsonPathExpression("$.a.*.c[*]"),
                new JsonPathExpression("$.*.b.c[:]"),
                new JsonPathExpression("$.*.b.c[7]"),
                new JsonPathExpression("$['c','d'].b.c[*]")
            };
            var expected = new List <JsonPathExpression>
            {
                new JsonPathExpression("$.a.*.c[*]"),
                new JsonPathExpression("$.*.b.c[:]")
            };

            bool matched = matchingSet.Matches(new JsonPathExpression("$.a.b.c[42]"), out var actual);

            matched.Should().BeTrue();
            actual.Should().BeEquivalentTo(expected);
        }