Commit 6e652f69 authored by Scott DePouw's avatar Scott DePouw

HomeControllerIndexShould now uses CustomWebApplicationFactory.

parent 8413066e
using System.Threading.Tasks; using CleanArchitecture.Web;
using System.Net.Http;
using System.Threading.Tasks;
using Xunit; using Xunit;
namespace CleanArchitecture.Tests.Integration.Web namespace CleanArchitecture.Tests.Integration.Web
{ {
public class HomeControllerIndexShould : BaseWebTest public class HomeControllerIndexShould : IClassFixture<CustomWebApplicationFactory<Startup>>
{ {
public HttpClient Client { get; }
public HomeControllerIndexShould(CustomWebApplicationFactory<Startup> factory)
{
Client = factory.CreateClient();
}
[Fact] [Fact]
public async Task ReturnViewWithCorrectMessage() public async Task ReturnViewWithCorrectMessage()
{ {
var response = await _client.GetAsync("/"); HttpResponseMessage response = await Client.GetAsync("/");
response.EnsureSuccessStatusCode(); response.EnsureSuccessStatusCode();
var stringResponse = await response.Content.ReadAsStringAsync(); string stringResponse = await response.Content.ReadAsStringAsync();
Assert.Contains("CleanArchitecture.Web", stringResponse); Assert.Contains("CleanArchitecture.Web", stringResponse);
} }
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment