protected override void CreateAndSeedDatabase(string databaseName, Func <MonsterContext> createContext, Action <MonsterContext> seed) { _testStore = SqlServerTestStore.GetOrCreateShared(databaseName, () => { using (var context = createContext()) { context.Database.EnsureCreated(); seed(context); } }); }
public ExecutionStrategyTest(ExecutionStrategyFixture fixture) { Fixture = fixture; TestStore = SqlServerTestStore.GetOrCreateShared(DatabaseName, () => { using (var context = CreateContext()) { context.Database.EnsureCreated(); } }); }
public override SqlServerTestStore CreateTestStore() { return(SqlServerTestStore.GetOrCreateShared(DatabaseName, () => { using (var context = new FindContext(_options)) { context.Database.EnsureCreated(); Seed(context); } })); }
public override SqlServerTestStore CreateTestStore() => SqlServerTestStore.GetOrCreateShared(DatabaseName, () => { var optionsBuilder = new DbContextOptionsBuilder() .UseSqlServer(SqlServerTestStore.CreateConnectionString(DatabaseName), b => b.ApplyConfiguration()) .UseInternalServiceProvider(_serviceProvider); using (var context = new AdvancedPatternsMasterContext(optionsBuilder.Options)) { context.Database.EnsureCreated(); Seed(context); } });
public override SqlServerTestStore CreateTestStore() { return(SqlServerTestStore.GetOrCreateShared(DatabaseName, () => { var optionsBuilder = new DbContextOptionsBuilder() .UseSqlServer(SqlServerTestStore.CreateConnectionString(DatabaseName), b => { b.ApplyConfiguration(); }) .UseInternalServiceProvider(_serviceProvider); using (var context = new StoreGeneratedContext(optionsBuilder.Options)) { context.Database.EnsureCreated(); } })); }
public NullKeysSqlServerFixture() { var name = "StringsContext"; var connectionString = SqlServerTestStore.CreateConnectionString(name); _options = new DbContextOptionsBuilder() .UseSqlServer(connectionString, b => b.ApplyConfiguration()) .UseInternalServiceProvider(new ServiceCollection() .AddEntityFrameworkSqlServer() .AddSingleton(TestModelSource.GetFactory(OnModelCreating)) .BuildServiceProvider(validateScopes: true)) .Options; _testStore = SqlServerTestStore.GetOrCreateShared(name, EnsureCreated); }
public SqlAzureFixture() { SqlServerTestStore.GetOrCreateShared( "adventureworks", () => SqlServerTestStore.ExecuteScript("adventureworks", "SqlAzure/adventureworks.sql"), cleanDatabase: false); Services = new ServiceCollection() .AddEntityFrameworkSqlServer() .AddSingleton <ILoggerFactory>(new TestSqlLoggerFactory()).BuildServiceProvider(); Options = new DbContextOptionsBuilder() .UseInternalServiceProvider(Services) .EnableSensitiveDataLogging() .UseSqlServer(SqlServerTestStore.CreateConnectionString("adventureworks"), b => b.ApplyConfiguration()).Options; }
public SqlAzureFixture() { SqlServerTestStore.GetOrCreateShared( "adventureworks", () => SqlServerTestStore.ExecuteScript( "adventureworks", Path.Combine( Path.GetDirectoryName(typeof(SqlAzureFixture).GetTypeInfo().Assembly.Location), "SqlAzure", "adventureworks.sql")), cleanDatabase: false); Services = new ServiceCollection() .AddEntityFrameworkSqlServer() .AddSingleton <ILoggerFactory>(TestSqlLoggerFactory).BuildServiceProvider(); Options = new DbContextOptionsBuilder() .UseInternalServiceProvider(Services) .EnableSensitiveDataLogging() .UseSqlServer(SqlServerTestStore.CreateConnectionString("adventureworks"), b => b.ApplyConfiguration()).Options; }
public override SqlServerTestStore CreateTestStore() { var testStore = SqlServerTestStore.GetOrCreateShared(DatabaseName, () => { var options = new DbContextOptionsBuilder() .UseSqlServer(SqlServerTestStore.CreateConnectionString(DatabaseName), b => b.ApplyConfiguration()) .UseInternalServiceProvider(_serviceProvider) .Options; using (var context = new GraphUpdatesContext(options)) { context.Database.EnsureCreated(); Seed(context); } }); _options = new DbContextOptionsBuilder() .UseSqlServer(testStore.Connection, b => b.ApplyConfiguration()) .UseInternalServiceProvider(_serviceProvider) .Options; return(testStore); }
public static SqlServerTestStore GetSharedStore() { return(SqlServerTestStore.GetOrCreateShared( DatabaseName, () => SqlServerTestStore.CreateDatabaseIfNotExists(DatabaseName, scriptPath: @"..\..\Northwind.sql"))); // relative from bin/<config> }
public virtual SqlServerTestStore CreateDatabase() => SqlServerTestStore.GetOrCreateShared("CommandConfiguration", null);
public static SqlServerTestStore GetSharedStore() => SqlServerTestStore.GetOrCreateShared( DatabaseName, () => SqlServerTestStore.ExecuteScript(DatabaseName, @"Northwind.sql"), cleanDatabase: false);
public static SqlServerTestStore GetSharedStore() { return(SqlServerTestStore.GetOrCreateShared( DatabaseName, () => SqlServerTestStore.CreateDatabase(DatabaseName, scriptPath: @"Northwind.sql"))); }
public SqlServerE2EFixture() { _testStore = SqlServerTestStore.GetOrCreateShared( "SqlServerReverseEngineerTestE2E", () => SqlServerTestStore.ExecuteScript("SqlServerReverseEngineerTestE2E", "ReverseEngineering/E2E.sql")); }
public override SqlServerTestStore CreateTestStore() => SqlServerTestStore.GetOrCreateShared(DatabaseName, EnsureCreated);