Skip to content

Instantly share code, notes, and snippets.

@AnthonyGiretti
Created March 16, 2021 16:54
Show Gist options
  • Save AnthonyGiretti/a443adaa5375f61d9c602dab0336107e to your computer and use it in GitHub Desktop.
Save AnthonyGiretti/a443adaa5375f61d9c602dab0336107e to your computer and use it in GitHub Desktop.
Web application factory that uses a custom startup file for integration tests
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
namespace Calzolari.WebApi.Tests.Common
{
public class MyWebFactory : WebApplicationFactory<Startup>
{
protected override IHostBuilder CreateHostBuilder()
{
return Host.CreateDefaultBuilder().ConfigureWebHost((builder) =>
{
builder.UseStartup<TestStartup>();
});
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment