Esempio n. 1
0
        public void TestTemplateViewModel()
        {
            IViewEngine viewEngine   = new BoroViewEngine();
            var         actualResult = viewEngine.GetHtml(@"@foreach(var num in Model)
{
<p>@num</p>
}", new List <int> {
                1, 2, 3
            }, null);
            var expectedResult = @"<p>1</p>
<p>2</p>
<p>3</p>";

            Assert.Equal(expectedResult, actualResult);
        }
Esempio n. 2
0
        public void TestGetHtml(string fileName)
        {
            var viewModel = new TestViewModel
            {
                DateOfBirth = new DateTime(2019, 6, 1),
                Name        = "Doggo Arghentino",
                Price       = 12345.67M,
            };

            IViewEngine viewEngine     = new BoroViewEngine();
            var         view           = File.ReadAllText($"ViewTests/{fileName}.html");
            var         actualResult   = viewEngine.GetHtml(view, viewModel, null);
            var         expectedResult = File.ReadAllText($"ViewTests/{fileName}.Result.html");

            Assert.Equal(expectedResult, actualResult);
        }