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 Model_with_property_and_helper_method() { var model = new ModelWithMethod() { TheVariable = "azerty" }; var c = new GlobalContext(); c.Register("Model", model); var e = new TemplateEngine(c); var result = e.Process("Hello, <%= Model.Reverse( Model.TheVariable ) %>"); result.Text.Should().Be($"Hello, {model.Reverse( model.TheVariable )}"); }