Exemplo n.º 1
0
        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());
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
 internal override void Accept(TemplateEvaluator evaluator)
 {
     evaluator.EvalMethod(this);
 }