Ejemplo n.º 1
0
        public void TestTextDecoration(string textDecoration, string expected)
        {
            var    tree   = TextDecorationParserFacade.ParseTextDecoration(textDecoration);
            string actual = (string)_evaluator.Visit(tree, null);

            Assert.Equal(expected, actual);
        }
        public TextDecorationExEvaluator(string objectDecoration,
                                         Func <string, string> evaluateVariable,
                                         Func <string, IEnvelope, object> evaluateRecordVariable,
                                         ILogger logger
                                         )
        {
            _tree = TextDecorationParserFacade.ParseTextDecoration(objectDecoration);
            FunctionBinder binder = new FunctionBinder(new Type[] { typeof(BuiltInFunctions) });
            ExpressionEvaluationContext <IEnvelope> evalContext = new ExpressionEvaluationContext <IEnvelope>(
                evaluateVariable,
                evaluateRecordVariable,
                binder,
                logger
                );
            var validator = new TextDecorationValidator <IEnvelope>(evalContext);

            validator.Visit(_tree, null); //Should throw if cannot resolve function
            _interpreter = new TextDecorationInterpreter <IEnvelope>(evalContext);
        }