public async Task CanAddArticle() { var db = new PlugableContext(SimplePluginFixture.Plugins, services => services.AddEntityFrameworkInMemoryDatabase(), SimplePluginFixture.Options); var countBefore = await db.Articles().CountAsync(); db.Articles().Add(Article.Default()); await db.SaveChangesAsync(); Assert.Equal(countBefore + 1, await db.Articles().CountAsync()); }
public async Task CanMigrate() { string testDb = Path.GetTempFileName(); var db = new PlugableContext( Fixture.Plugins, services => services.AddEntityFrameworkSqlite(), new DbContextOptionsBuilder().UseSqlite($"Data Source={testDb}").Options ); await db.Database.MigrateAsync(); db.Articles().Add(Article.Default()); await db.SaveChangesAsync(); Assert.Equal(1, await db.Articles().CountAsync()); File.Delete(testDb); }