public void EvalMethod_GetResult_return_result_of_method() { var model = new ModelWithMethod(null, "123"); var evaluator = new TemplateEvaluator(model); var element = new MethodCallTemplateElement { MethodName = "GetText" }; evaluator.EvalMethod(element); Assert.AreEqual("123", evaluator.GetResult()); }
public void EvalMethod_throw_TemplateEvaluateException_if_method_does_not_exist() { var model = new Model(null); var evaluator = new TemplateEvaluator(model); var element = new MethodCallTemplateElement { MethodName = "SomeMethod" }; var exception = Assert.Throws <TemplateEvaluateException>(() => evaluator.EvalMethod(element)); Assert.AreEqual("Method with name 'SomeMethod' does not exist in model.", exception.Message); }
internal override void Accept(TemplateEvaluator evaluator) { evaluator.EvalMethod(this); }