Esempio n. 1
0
        public void PathWithSlice_ReturnsExpectedResult(string path, string expectedJson)
        {
            expectedJson = expectedJson.Replace("`", "\"");
            string json = TestDataLoader.AbcArray();

            IReadOnlyList <JsonElement> result = JsonPath.ExecutePath(path, json);
            string resultJson = JsonSerializer.Serialize(result);

            Assert.Equal(expectedJson, resultJson);
        }
Esempio n. 2
0
        public void PathWithAllElements_ReturnsExpectedResult()
        {
            string path = "[*]";
            string json = TestDataLoader.AbcArray();

            IReadOnlyList <JsonElement> result = JsonPath.ExecutePath(path, json);
            string resultJson = JsonSerializer.Serialize(result);

            json = new string(json.Where(x => !char.IsWhiteSpace(x)).ToArray());

            Assert.Equal(json, resultJson);
        }