Sample ASP.NET Core 6.0 reference application, powered by Microsoft, demonstrating a layered application architecture with monolithic deployment model. Download the eBook PDF from docs folder.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

30 lines
884 B

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);
}
}
}