private CumContext GetInMemoryDBContext() { var serviceProvider = new ServiceCollection() .AddEntityFrameworkInMemoryDatabase() .BuildServiceProvider(); var builder = new DbContextOptionsBuilder <CumContext>(); var options = builder.UseInMemoryDatabase("test").UseInternalServiceProvider(serviceProvider).Options; CumContext dbContext = new CumContext(options); dbContext.Database.EnsureDeleted(); dbContext.Database.EnsureCreated(); return(dbContext); }
public BaseTest(CumContext cxt = null) { this.cxt = cxt ?? GetInMemoryDBContext(); }