Пример #1
0
 public void Should_throw_if_attempt_to_use_partials_without_veilcontext()
 {
     Assert.Throws <InvalidOperationException>(() =>
     {
         var view = new VeilEngine().Compile <ViewModel>("supersimple", new StringReader("Hello @Partial['Person'];"));
     });
 }
Пример #2
0
        public void Should_work_with_no_veilcontext()
        {
            var view = new VeilEngine().Compile <ViewModel>("supersimple", new StringReader("Hello @Model.Name"));

            using (var writer = new StringWriter())
            {
                view(writer, new ViewModel {
                    Name = "Joe"
                });
                Assert.That(writer.ToString(), Is.EqualTo("Hello Joe"));
            }
        }