I have a ASP.NET Core project with some simple Razor pages and a Web API controller.
I\'m using Clean Architecture as a starting point. I\'ve renamed the project names,
My solution for this problem is define WebApplicationFactory
with Application Startup but setup WebHostBuilder
with TestStartup.
Example:
public class MyApplicationFactory : WebApplicationFactory
{
protected override IWebHostBuilder CreateWebHostBuilder()
{
return WebHost.CreateDefaultBuilder();
}
protected override void ConfigureWebHost(IWebHostBuilder builder)
{
builder.UseStartup();
base.ConfigureWebHost(builder);
}
}