Example #1
0
        public void RootReference()
        {
            var expression = (JsonPathPropertyExpression)JsonPathGrammar.Parse("foo");

            Assert.IsNull(expression.Target);
            Assert.AreEqual("foo", expression.Name);
        }
Example #2
0
        public Task ProcessOutput(ApiResponseModel response, ApiOutputModel output)
        {
            var expression = JsonPathGrammar.Parse(output.Expression);
            var value      = expression.Evaluate(response.JsonResponse);

            output.Value = value;

            return(TaskConstants.Completed);
        }
Example #3
0
        public void Indexer()
        {
            var expression = (JsonPathIndexerExpression)JsonPathGrammar.Parse("foo[10]");
            var target     = (JsonPathPropertyExpression)expression.Target;

            Assert.IsNull(target.Target);
            Assert.AreEqual("foo", target.Name);
            Assert.AreEqual(10, expression.Index);
        }
Example #4
0
        public void SubReference()
        {
            var expression = (JsonPathPropertyExpression)JsonPathGrammar.Parse("foo.bar");
            var target     = (JsonPathPropertyExpression)expression.Target;

            Assert.IsNull(target.Target);
            Assert.AreEqual("foo", target.Name);
            Assert.AreEqual("bar", expression.Name);
        }