public void TestSimpleObjectDecoration() { var parseTree = ObjectDecorationParserFacade.ParseObjectDecoration(TWO_KEYVALUE_PARIS_WITH_ONE_VARIBLE); Assert.Equal(2, parseTree.List.Count); Assert.Equal(" key1 ", parseTree.List[0].Key); Assert.Equal(3, ((NodeList <Node>)parseTree.List[0].Value).List.Count); Assert.Equal("key2", parseTree.List[1].Key); }
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); }
public void TestIncompleteObjectDecoration() { Assert.Throws <Exception>(() => ObjectDecorationParserFacade.ParseObjectDecoration(INCOMPLETE_OBJECTDECORATION)); }
public void TestObjectDecorationWithExpressions() { var parseTree = ObjectDecorationParserFacade.ParseObjectDecoration(OBJECTDECORATION_WITH_EXPRESSIONS); Assert.Equal(6, parseTree.List.Count); }