public async Task Index_Get_ReturnsListOfApplications() { // Arrange using (var app = new TestApplication()) { // Get predefined data var data = GetPredefinedData(); // Get seeder var seeder = app.GetSeeder(); // Write data to db await seeder.SeedAsync(data); var client = app.GetClient(); // Act var response = await client.GetAsync("/"); response.EnsureSuccessStatusCode(); var responseString = await response.Content.ReadAsStringAsync(); // Assert foreach (var application in data.Applications) { Assert.Contains($"<h5 class=\"card-title\">{application.Name}</h5>", responseString); } } }
public async Task Index_Get_ReturnsIndexHtmlPage() { // Arrange using (var app = new TestApplication()) { var client = app.GetClient(); // Act var response = await client.GetAsync("/"); response.EnsureSuccessStatusCode(); var responseString = await response.Content.ReadAsStringAsync(); // Assert Assert.Contains("<title>Home Page - WebsiteMonitorApplication.Web</title>", responseString); } }