public void TestExpression(string input, int exprectedErrorCount, string failureMessage)
        {
            var result           = new Result();
            var SemanticAnalyzer = new ExposedSemanticAnalyzer(result);
            var node             = ASTFactory.BuildExpression(input);

            SemanticAnalyzer.AnalyzeAstNode(node);

            Assert.AreEqual(exprectedErrorCount, result.Events.Count, failureMessage);
        }
Exemple #2
0
        public void TestExpression(Dictionary <string, object> context, string expression, object expectedResult)
        {
            var questions = new List <Questionnaires.RunTime.Question>();

            foreach (var value in context)
            {
                questions.Add(ValueCreator.CreateQuestion(value.Key, (dynamic)value.Value));
            }

            var store = new QuestionStore(questions);

            var astFactory = new ASTBuilder(new Result());
            var AST        = astFactory.BuildExpression(expression);

            var evaluator = new Questionnaires.RunTime.ExpressionEvaluator(store);
            var result    = evaluator.Evaluate((IExpression)AST);

            Value.ValueTester.Test((dynamic)result, expectedResult);
        }
Exemple #3
0
 public T CreateASTNode <T>(string input) where T : INode
 {
     return((T)astFactory.BuildExpression(input));
 }