Tests: Remove old DBContext to use custom Testcontainer DB
This commit is contained in:
parent
418153ffce
commit
421d33df99
@ -18,6 +18,12 @@ public class StreetWebApplicationFactory<Program> : WebApplicationFactory<Progra
|
||||
builder.ConfigureServices(services =>
|
||||
{
|
||||
|
||||
var descriptor = services.SingleOrDefault(d => d.ServiceType == typeof(DbContextOptions<StreetDbContext>));
|
||||
if (descriptor != null)
|
||||
{
|
||||
services.Remove(descriptor);
|
||||
}
|
||||
|
||||
// Use the test database
|
||||
services.AddDbContext<StreetDbContext>(options => options.UseNpgsql(dbTestContainer.GetConnectionString(), o => o.UseNetTopologySuite()));
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user