When creating integration tests for ASP.NET Core 10 web apps, we use the WebApplicationFactory<TEntryPoint> class. When a single ASP.NET Core web project is used as SUT, it's simple and it works:
internal class CustomWebApplicationFactory : WebApplicationFactory<Program>
{
internal string? WebRootPath { get; private set; }
protected override void ConfigureWebHost(IWebHostBuilder builder)
{
...
}
}
But what if I need to use 2 (or more) web apps in a single integration testing project? How can I specify which entry point class to use?
I tried WebApplicationFactory<MyAssembly.Program> but the compiler throws an error:
The type or namespace name 'Program' does not exist in the namespace 'MyAssembly' (are you missing an assembly reference?)
And no, I do have a reference to both of my web apps.