Files
eShopOnWeb/tests/FunctionalTests/Web/Controllers/CatalogControllerIndex.cs
Steve Smith 814d3e249c Adding Tests and Refactoring
Functional Tests for RazorPages added
2018-05-31 12:28:55 -04:00

31 lines
884 B
C#

using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.eShopWeb;
using System.Net.Http;
using System.Threading.Tasks;
using Xunit;
namespace FunctionalTests.Web.Controllers
{
public class CatalogControllerIndex : IClassFixture<CustomWebApplicationFactory<Startup>>
{
public CatalogControllerIndex(CustomWebApplicationFactory<Startup> factory)
{
Client = factory.CreateClient();
}
public HttpClient Client { get; }
[Fact]
public async Task ReturnsHomePageWithProductListing()
{
// Arrange & Act
var response = await Client.GetAsync("/");
response.EnsureSuccessStatusCode();
var stringResponse = await response.Content.ReadAsStringAsync();
// Assert
Assert.Contains(".NET Bot Black Sweatshirt", stringResponse);
}
}
}