private void ResetDatabase() { var options = new DbContextOptionsBuilder <eFlightDbContext>().UseSqlServer(SetupTest._appSettings.ConnectionString).Options; _context = new eFlightDbContext(options); _seeder = new TestSeed(_context); _seeder.RunSeed(); }
public DatabaseFixture() { _appSettings = new ConfigurationBuilder() .AddJsonFile("appsettings.json") .Build(); _connectionString = _appSettings.GetValue <string>("AppSettings:ConnectionString"); var serviceProvider = new ServiceCollection() .AddEntityFrameworkInMemoryDatabase() .BuildServiceProvider(); var options = new DbContextOptionsBuilder <ProjectsPortifolioDbContext>() .UseInMemoryDatabase(_connectionString) .UseInternalServiceProvider(serviceProvider) .Options; Context = new ProjectsPortifolioDbContext(options); Seeder = new TestSeed(Context); Seeder.RunSeed(); }