I've found older solutions to this problem, but nothing for .NET 6 webapps that only use Program.cs and hope someone can point me in the right direction.
And it works great, we can arrange whatever data we want in the DBContext in the test:
using (var scope = scopeFactory.CreateScope())
{
var context = scope.ServiceProvider.GetService<PriceListDbContext>();
var agency = new Agency();
agency.AgencyName = "DAS";
agency.AgencyNo = 15000;
context.Agencies.Add(agency);
context.SaveChanges();
}
in a SQLite instance and then do integration tests using the client from the factory.
But when we try to fire up Selenium in a test with that DBContext arrange, the data isn't there. So, seems like we're hitting two separate apps. There are posts about how to solve this in older dotnet versions, but not the newer versions when we don't use a separate startup.cs file.