Example #1
0
        public void JsonPathExtractionFunctionTest()
        {
            var json          = "{\"title\": \"Person\",\"type\": \"LivingThing\"}";
            var jsonPath      = "$.title";
            var jsonExtracted = ExtractionFunctions.JsonPathFunc(json, jsonPath).Result;

            Assert.Equal("Person", jsonExtracted);

            jsonExtracted = ExtractionFunctions.JsonPathFunc(json, "$.Yolo").Result;
            Assert.Equal(string.Empty, jsonExtracted);
        }
Example #2
0
        public void JsonPathExtractionFunctionTest_InvalidJson()
        {
            var json     = "title:Person,type:LivingThing";
            var jsonPath = "$.title";

            try
            {
                ExtractionFunctions.JsonPathFunc(json, jsonPath).Wait();
            }
            catch (Exception)
            {
                return;
            }
            Assert.True(false);
        }