public void TestGetHtml(string fileName) { var viewModel = new TestViewModel { Price = 12345.67M, Name = "Doggo Arghentino", DateOfBirth = new DateTime(1997, 3, 17), }; IViewEngine viewEngine = new SusViewEngine(); var view = File.ReadAllText($"ViewTests/{fileName}.html"); var result = viewEngine.GetHtml(view, viewModel); var expectedResult = File.ReadAllText($"ViewTests/{fileName}.Result.html"); Assert.Equal(expectedResult, result); }
public void TestGetHtml(string fileName) { var viewModel = new TestViewModel { DateOfBirth = new DateTime(2019, 6, 1), Name = "Doggo", Price = 250.50M }; IViewEngine viewEngine = new SusViewEngine(); var view = File.ReadAllText($"ViewTests/{fileName}.html"); var result = viewEngine.GetHtml(view, viewModel); var expectedResult = File.ReadAllText($"ViewTests/{fileName}.Result.html"); Assert.Equal(expectedResult, result); }
public void TestTemplateViewMode() { IViewEngine viewEngine = new SusViewEngine(); var actualResult = viewEngine.GetHtml(@"@foreach(var num in Model) { <span>@num</span> }", new List <int> { 1, 2, 3 }, null); var expectedResult = @"<span>1</span> <span>2</span> <span>3</span>"; Assert.Equal(expectedResult, actualResult); }
public void TestGetHtml(string fileName) { var viewModel = new TestViewModel() { DateOfBirth = new DateTime(2019, 6, 1), Name = "Doggo Argentino", Price = 12345.67M, }; IViewEngine viewEngine = new SusViewEngine(); string view = File.ReadAllText($"ViewTests/{fileName}.html"); string actualResult = viewEngine.GetHtml(view, viewModel, null); string expectedResult = File.ReadAllText($"ViewTests/{fileName}.Result.html"); Assert.Equal(expectedResult, actualResult); }
public void TestGetHtml(string fileName) { var viewModel = new TestViewModel { DateOfBirth = new DateTime(2019, 6, 1), Name = "Na baba kucheto", Price = 12345.67m }; IViewEngine viewEngine = new SusViewEngine(); var view = File.ReadAllText($"ViewTests/{fileName}.html"); var result = viewEngine.GetHtml(view, viewModel, null).Trim(); //.Trim() var expectedResult = File.ReadAllText($"ViewTests/{fileName}.Result.html").Trim(); //.Trim() - 2 Assert.Equal(expectedResult, result); //view, result??? }
public void TestTemplateViewModel() { IViewEngine engine = new SusViewEngine(); var actual = engine.GetHtml(@"@foreach (var num in Model) { <span>@num</span> }", new List <int> { 1, 2, 3, 4 }); var expected = @"<span>1</span> <span>2</span> <span>3</span> <span>4</span> "; Assert.Equal(expected, actual); }
public void TestHtml(string fileName) { var viewModel = new TestViewModel() { Name = "First test view model", Value = "The good view model", Numbers = new List <int>() { 1, 2, 3, 4, 5 } }; IViewEngine engine = new SusViewEngine(); var view = File.ReadAllText($"Tests/{fileName}.Actual.html"); var result = engine.GetHtml(view, viewModel); var expected = File.ReadAllText($"Tests/{fileName}.Expected.html"); Assert.Equal(expected, result); }
public void TestGetHtml(string fileName) { TestViewModel viewModel = new TestViewModel { Name = "Pesho", Email = "*****@*****.**", DateOfBirth = new DateTime(1985, 5, 16), SomeNumber = 121 }; IViewEngine viewEngine = new SusViewEngine(); string testFilePath = "ViewTests/" + fileName + "-Test.html"; var view = File.ReadAllText(testFilePath); var result = viewEngine.GetHtml(view, viewModel); string resultFilePath = "ViewTests/" + fileName + "-Result.html"; var expectedResult = File.ReadAllText(resultFilePath); Assert.AreEqual(expectedResult, result); }
static async Task Main(string[] args) { List <Route> routTable = new List <Route>(); SusViewEngine test = new SusViewEngine(); var test2 = test.GetHtml(string.Empty, null); routTable.Add(new Route("/", HttpMethod.Get, new HomeController().Index)); routTable.Add(new Route("/Home/About", HttpMethod.Get, new HomeController().About)); routTable.Add(new Route("/Users/Login", HttpMethod.Get, new UsersController().Login)); routTable.Add(new Route("/Users/Register", HttpMethod.Get, new UsersController().Register)); routTable.Add(new Route("/Cards/All", HttpMethod.Get, new CardsController().All)); routTable.Add(new Route("/Cards/Add", HttpMethod.Get, new CardsController().Add)); routTable.Add(new Route("/Cards/Collection", HttpMethod.Get, new CardsController().Collection)); routTable.Add(new Route("/favicon.ico", HttpMethod.Get, new StaticFilesController().FavIco)); routTable.Add(new Route("/css/bootstrap.min.css", HttpMethod.Get, new StaticFilesController().BootstrapCss)); routTable.Add(new Route("/css/custom.css", HttpMethod.Get, new StaticFilesController().CustomCss)); routTable.Add(new Route("/js/custom.js", HttpMethod.Get, new StaticFilesController().CustomJs)); routTable.Add(new Route("/js/bootstrap.bundle.mini.js", HttpMethod.Get, new StaticFilesController().BootstrapJs)); await Host.RunAsync(new StratUp(), 80); }