public override JetTestStore CreateTestStore() { return(JetTestStore.GetOrCreateShared(DatabaseName, () => { using (var context = new LoadContext(_options)) { context.Database.EnsureCreated(); Seed(context); } })); }
public override JetTestStore CreateTestStore() { return(JetTestStore.GetOrCreateShared(DatabaseName, () => { var optionsBuilder = new DbContextOptionsBuilder() .UseJet(JetTestStore.CreateConnectionString(DatabaseName), b => b.ApplyConfiguration()) .UseInternalServiceProvider(_serviceProvider); using (var context = new FieldMappingContext(optionsBuilder.Options)) { context.Database.EnsureClean(); Seed(context); } })); }
public NullKeysJetFixture() { var name = "StringsContext"; var connectionString = JetTestStore.CreateConnectionString(name); _options = new DbContextOptionsBuilder() .UseJet(connectionString, b => b.ApplyConfiguration()) .UseInternalServiceProvider(new ServiceCollection() .AddEntityFrameworkJet() .AddSingleton(TestModelSource.GetFactory(OnModelCreating)) .BuildServiceProvider()) .Options; _testStore = JetTestStore.GetOrCreateShared(name, EnsureCreated); }
public override JetTestStore CreateTestStore() { return(JetTestStore.GetOrCreateShared(DatabaseName, () => { var optionsBuilder = new DbContextOptionsBuilder() .UseJet(JetTestStore.CreateConnectionString(DatabaseName)) .UseInternalServiceProvider(_serviceProvider); using (var context = new AdvancedPatternsMasterContext(optionsBuilder.Options)) { context.Database.EnsureClean(); Seed(context); } })); }
protected override void CreateAndSeedDatabase(string databaseName, Func <MonsterContext> createContext, Action <MonsterContext> seed) { _testStore = JetTestStore.GetOrCreateShared(databaseName, () => { using (var context = createContext()) { context.Database.EnsureCreated(); // The test uses a foreign key to a couple of fields not to the primary key of the target table // If one of the fields is null the SQL Server does not check the foreign key constraint // JET check the foreign key constraint always if there is one of the fields not null context.Database.ExecuteSqlCommand("ALTER TABLE ProductWebFeature DROP CONSTRAINT FK_ProductWebFeature_ProductPhoto_PhotoId_ProductId"); context.Database.ExecuteSqlCommand("ALTER TABLE ProductWebFeature DROP CONSTRAINT FK_ProductWebFeature_ProductReview_ReviewId_ProductId"); seed(context); } }); }
public override JetTestStore CreateTestStore() => JetTestStore.GetOrCreateShared(DatabaseName, EnsureCreated);
public static JetTestStore GetNorthwindStore() => JetTestStore.GetOrCreateShared(NorthwindName, () => { });