Example #1
0
            public override DbContext CreateContext(JetTestStore testStore)
            {
                var optionsBuilder = new DbContextOptionsBuilder()
                                     .UseJet(testStore.Connection, b => b.ApplyConfiguration())
                                     .UseInternalServiceProvider(_serviceProvider);

                var context = new FieldMappingContext(optionsBuilder.Options);

                context.Database.UseTransaction(testStore.Transaction);

                return(context);
            }
                public override DbContext CreateContext(SqliteTestStore testStore)
                {
                    var optionsBuilder = new DbContextOptionsBuilder()
                                         .UseSqlite(testStore.Connection)
                                         .UseInternalServiceProvider(_serviceProvider);

                    var context = new FieldMappingContext(optionsBuilder.Options);

                    context.Database.UseTransaction(testStore.Transaction);

                    return(context);
                }
Example #3
0
            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);
                    }
                }));
            }