public TextDecorationTest() { FunctionBinder binder = new FunctionBinder(new Type[] { typeof(BuiltInFunctions) }); ExpressionEvaluationContext <object> context = new ExpressionEvaluationContext <object>( VariableMock.GetGlobalVariable, VariableMock.GetLocalVariable, binder, null); _evaluator = new TextDecorationInterpreter <object>(context); }
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); }