예제 #1
0
        public void FilterOnNonExistingPropertyEqualNull_ReturnsCorrectResult()
        {
            string input = TestDataLoader.BooksWithNulls();

            ExpressionList expression = ExpressionList.TokenizeAndParse("$.books[?(@.plumbus == null)]");

            IReadOnlyList <JsonElement> result = JsonPath.ExecutePath(expression, input);

            Assert.Equal(4, result.Count);
        }
예제 #2
0
        public void FilterOnNumberEqualNull_ReturnsCorrectResult()
        {
            string input = TestDataLoader.BooksWithNulls();

            ExpressionList expression = ExpressionList.TokenizeAndParse("$.books[?(@.price== null)]");

            IReadOnlyList <JsonElement> result = JsonPath.ExecutePath(expression, input);

            Assert.Equal(1, result.Count);
            Assert.Equal(JsonValueKind.Object, result[0].ValueKind);
            Assert.Equal("Sayings of the Century", result[0].EnumerateObject().FirstOrDefault(x => x.Name == "title").Value.GetString());
        }