public void TestInitialize() { var factory = new EffortDataContextFactory(Effort.DbConnectionFactory.CreateTransient()); Context = factory.CreateContext(); Seeder.Seed(Context); Stock1 = Context.Stocks.Where(x => x.Name == "First").Single(); Stock2 = Context.Stocks.Where(x => x.Name == "Second").Single(); Service = new Service(factory); TestSeed(); }
public void Setup() { //New in-memory SQLite database sqliteConnection = new SqliteConnection("DataSource=:memory:"); sqliteConnection.Open(); var options = new DbContextOptionsBuilder <BackendContext>() .UseSqlite(sqliteConnection) .Options; backendContext = new BackendContext(options); backendContext.Database.EnsureCreated(); Seeder.Seed(backendContext); }