using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.Extensions.Hosting;
// ReSharper disable ClassNeverInstantiated.Global
namespace Retroactiune.IntegrationTests.Retroactiune.WebAPI
{
///
/// Custom WebApplicationFactory used in integration testing, it uses TestingStartup for testing instead of Startup.
///
public class WebApiTestingFactory : WebApplicationFactory
{
protected override IHostBuilder CreateHostBuilder()
{
return Host.CreateDefaultBuilder().ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup();
});
}
protected override void ConfigureWebHost(IWebHostBuilder builder)
{
builder.UseContentRoot(".");
base.ConfigureWebHost(builder);
}
}
}