示例#1
0
 public NotificationEntitiesSqlServerFixture()
 {
     _options = new DbContextOptionsBuilder()
                .UseSqlServer(SqlServerTestStore.CreateConnectionString(DatabaseName), b => b.ApplyConfiguration())
                .UseInternalServiceProvider(new ServiceCollection()
                                            .AddEntityFrameworkSqlServer()
                                            .AddSingleton(TestSqlServerModelSource.GetFactory(OnModelCreating))
                                            .BuildServiceProvider())
                .Options;
 }
            public NullKeysSqlServerFixture()
            {
                _options = new DbContextOptionsBuilder()
                           .UseSqlServer(SqlServerTestStore.CreateConnectionString("StringsContext"))
                           .UseInternalServiceProvider(new ServiceCollection()
                                                       .AddEntityFrameworkSqlServer()
                                                       .AddSingleton(TestSqlServerModelSource.GetFactory(OnModelCreating))
                                                       .BuildServiceProvider())
                           .Options;

                EnsureCreated();
            }
            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 LoadSqlServerFixture()
            {
                var serviceProvider = new ServiceCollection()
                                      .AddEntityFrameworkSqlServer()
                                      .AddSingleton(TestModelSource.GetFactory(OnModelCreating))
                                      .AddSingleton <ILoggerFactory, TestSqlLoggerFactory>()
                                      .BuildServiceProvider();

                _options = new DbContextOptionsBuilder()
                           .UseSqlServer(SqlServerTestStore.CreateConnectionString(DatabaseName), b => b.ApplyConfiguration())
                           .UseInternalServiceProvider(serviceProvider)
                           .EnableSensitiveDataLogging()
                           .Options;
            }
示例#5
0
            public override SqlServerTestStore CreateTestStore()
            {
                return(SqlServerTestStore.GetOrCreateShared(DatabaseName, () =>
                {
                    var optionsBuilder = new DbContextOptionsBuilder();
                    optionsBuilder.UseSqlServer(SqlServerTestStore.CreateConnectionString(DatabaseName));

                    using (var context = new StoreGeneratedContext(_serviceProvider, optionsBuilder.Options))
                    {
                        context.Database.EnsureDeleted();
                        context.Database.EnsureCreated();
                    }
                }));
            }
            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(TestSqlServerModelSource.GetFactory(OnModelCreating))
                                                       .BuildServiceProvider())
                           .Options;

                _testStore = SqlServerTestStore.GetOrCreateShared(name, EnsureCreated);
            }
示例#8
0
            public override SqlServerTestStore CreateTestStore()
            {
                return(SqlServerTestStore.GetOrCreateShared(DatabaseName, () =>
                {
                    var optionsBuilder = new DbContextOptionsBuilder()
                                         .UseSqlServer(SqlServerTestStore.CreateConnectionString(DatabaseName))
                                         .UseInternalServiceProvider(_serviceProvider);

                    using (var context = new GraphUpdatesContext(optionsBuilder.Options))
                    {
                        context.Database.EnsureClean();
                        Seed(context);
                    }
                }));
            }
            public NotificationEntitiesSqlServerFixture()
            {
                _serviceProvider = new ServiceCollection()
                                   .AddEntityFramework()
                                   .AddSqlServer()
                                   .ServiceCollection()
                                   .AddSingleton(TestSqlServerModelSource.GetFactory(OnModelCreating))
                                   .BuildServiceProvider();

                var optionsBuilder = new DbContextOptionsBuilder();

                optionsBuilder.UseSqlServer(SqlServerTestStore.CreateConnectionString("NotificationEntities"));
                _options = optionsBuilder.Options;

                EnsureCreated();
            }
            public ExecutionStrategyFixture()
            {
                var serviceProvider = new ServiceCollection()
                                      .AddEntityFrameworkSqlServer()
                                      .AddSingleton <ILoggerFactory, TestSqlLoggerFactory>()
                                      .AddScoped <ISqlServerConnection, TestSqlServerConnection>()
                                      .AddScoped <IRelationalCommandBuilderFactory, TestRelationalCommandBuilderFactory>()
                                      .BuildServiceProvider();

                _baseOptions = new DbContextOptionsBuilder()
                               .UseInternalServiceProvider(serviceProvider)
                               .EnableSensitiveDataLogging()
                               .Options;

                _options = new DbContextOptionsBuilder(_baseOptions)
                           .UseSqlServer(SqlServerTestStore.CreateConnectionString(DatabaseName), ApplySqlServerOptions)
                           .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);
            }
示例#12
0
 public override DbContext CreateContext()
 => new FindContext(new DbContextOptionsBuilder()
                    .UseSqlServer(SqlServerTestStore.CreateConnectionString("FindTest"))
                    .UseInternalServiceProvider(_serviceProvider)
                    .EnableSensitiveDataLogging()
                    .Options);
示例#13
0
 protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
 => optionsBuilder
 .EnableSensitiveDataLogging()
 .UseSqlServer(SqlServerTestStore.CreateConnectionString("Repro925"))
 .UseInternalServiceProvider(_serviceProvider);
示例#14
0
 protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
 => optionsBuilder.UseSqlServer(SqlServerTestStore.CreateConnectionString("NumNum"));
 protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
 => optionsBuilder.UseSqlServer(SqlServerTestStore.CreateConnectionString(_databaseName), b => b.ApplyConfiguration());
示例#16
0
 protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
 => optionsBuilder
 .UseInternalServiceProvider(_serviceProvider)
 .UseSqlServer(SqlServerTestStore.CreateConnectionString(_databaseName));
示例#17
0
            protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
            {
                var name = GetType().FullName.Substring((GetType().Namespace + nameof(SqlServerValueGenerationScenariosTest)).Length + 2);

                optionsBuilder.UseSqlServer(SqlServerTestStore.CreateConnectionString(name));
            }
 protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
 {
     optionsBuilder.UseSqlServer(SqlServerTestStore.CreateConnectionString(DatabaseName));
 }