Пример #1
0
        public ObjectDecorationValueEvaluatorTest()
        {
            FunctionBinder binder = new FunctionBinder(new Type[] { typeof(BuiltInFunctions) });
            ExpressionEvaluationContext <object> context = new ExpressionEvaluationContext <object>(
                VariableMock.GetGlobalVariable, VariableMock.GetLocalVariable, binder, null);

            _evaluator = new ObjectDecorationInterpreter <object>(context);
        }
        public ObjectDecorationExEvaluator(string objectDecoration,
                                           Func <string, string> evaluateVariable,
                                           Func <string, IEnvelope, object> evaluateRecordVariable,
                                           ILogger logger
                                           )
        {
            _tree = ObjectDecorationParserFacade.ParseObjectDecoration(objectDecoration);
            FunctionBinder binder = new FunctionBinder(new Type[] { typeof(BuiltInFunctions) });
            ExpressionEvaluationContext <IEnvelope> evalContext = new ExpressionEvaluationContext <IEnvelope>(
                evaluateVariable,
                evaluateRecordVariable,
                binder,
                logger
                );
            var validator = new ObjectDecorationValidator <IEnvelope>(evalContext);

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