Is it possible to create multiple TestServers for an integration test in dotnet 6?
With dotnet 3.1 this was possible because I could reference Startup.cs from the integration test. With dotnet 6 the Program.cs and Startup.cs became Program.cs. Now when I try to reference the Program.cs for the WebHostBuilder.UseStartup() this is not possible because I have multiple Program.cs and the Program.cs files don't have a namespace.
In dotnet 3.1 I had
var application1 = new WebHostBuilder().UseStartup<Poject1.Startup>()
var application2 = new WebHostBuilder().UseStartup<Poject2.Startup>()
var application3 = new WebHostBuilder().UseStartup<Poject3.Startup>()
In dotnet 6 this is not possible?
var application1 = new WebApplicationFactory<TProgram>().UseStartup<Poject1.Program>()
var application2 = new WebApplicationFactory<TProgram>().UseStartup<Poject2.Program>()
var application3 = new WebApplicationFactory<TProgram>().UseStartup<Poject3.Program>()
I get the error: The Type 'Program' exists in both 'Project1...' and 'Project2...'
The Program.cs files look like this:
// usings
var builder = WebApplication.CreateBuilder(args);
// inject services
var app = builder.Build();
// configure services
app.Run();
public partial class Program { }
Does anyone have a solution?