I understand that AspNetCore 2.1 is still in release candidate form and that new testing model with Microsoft.AspNetCore.Mvc.Testing
is not stabilized.
But I'm trying to follow examples and use WebApplicationTestFixture
class for testing. Here is code I have so far:
public class UnitTest1 : IClassFixture<WebApplicationTestFixture<Startup>>
{
public UnitTest1(WebApplicationTestFixture<Startup> fixture)
{
Client = fixture.CreateClient();
}
public HttpClient Client { get; }
[Fact]
public async void Test1()
{
var response = await Client.GetAsync("api/values");
response.EnsureSuccessStatusCode();
}
}
However, I can't find WebApplicationTestFixture
class in package anywhere. Is it located in additional assembly? Or I'm supposed to create this class?
It seems that during stabilization they've renamed this class. It is now named WebApplicationFactory
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With