예제 #1
0
 public void RunTest()
 {
     const string view = "Hello, @Model!";
     const string templateKey = "hello";
     Engine.Razor.AddTemplate(templateKey, new LoadedTemplateSource(view));
     var res = new RazorTemplateRuner().Run(templateKey, "World");
     Assert.AreEqual("Hello, World!", res);
 }
예제 #2
0
        public void RunTestWithCompilied1()
        {
            const string view = "Hello, @Model! @ViewBag.Title";
            const string templateKey = "hello1";
            Engine.Razor.AddTemplate(templateKey, new LoadedTemplateSource(view));

            var res = new RazorTemplateRuner().Run(templateKey, "Title", typeof (string), "World");
            Assert.AreEqual("Hello, World! Title", res);
        }