public static void Seed(FunkyDataContext context)
        {
            var c11 = new FunkyCustomer {
                FirstName = "%Bar", LastName = "%B", NullableBool = true
            };
            var c12 = new FunkyCustomer {
                FirstName = "Ba%r", LastName = "a%", NullableBool = true
            };
            var c13 = new FunkyCustomer {
                FirstName = "Bar%", LastName = "%B%", NullableBool = true
            };
            var c14 = new FunkyCustomer {
                FirstName = "%Ba%r%", LastName = null, NullableBool = false
            };
            var c15 = new FunkyCustomer {
                FirstName = "B%a%%r%", LastName = "r%", NullableBool = false
            };
            var c16 = new FunkyCustomer {
                FirstName = null, LastName = "%B%a%r"
            };
            var c17 = new FunkyCustomer {
                FirstName = "%B%a%r", LastName = ""
            };
            var c18 = new FunkyCustomer {
                FirstName = "", LastName = "%%r%"
            };

            var c21 = new FunkyCustomer {
                FirstName = "_Bar", LastName = "_B", NullableBool = false
            };
            var c22 = new FunkyCustomer {
                FirstName = "Ba_r", LastName = "a_", NullableBool = false
            };
            var c23 = new FunkyCustomer {
                FirstName = "Bar_", LastName = "_B_", NullableBool = false
            };
            var c24 = new FunkyCustomer {
                FirstName = "_Ba_r_", LastName = null, NullableBool = true
            };
            var c25 = new FunkyCustomer {
                FirstName = "B_a__r_", LastName = "r_", NullableBool = true
            };
            var c26 = new FunkyCustomer {
                FirstName = null, LastName = "_B_a_r"
            };
            var c27 = new FunkyCustomer {
                FirstName = "_B_a_r", LastName = ""
            };
            var c28 = new FunkyCustomer {
                FirstName = "", LastName = "__r_"
            };

            context.FunkyCustomers.AddRange(c11, c12, c13, c14, c15, c16, c17, c18, c21, c22, c23, c24, c25, c26, c27, c28);

            context.SaveChanges();
        }
        public override SqlCeTestStore CreateTestStore()
        {
            return(SqlCeTestStore.GetOrCreateShared(DatabaseName, () =>
            {
                var optionsBuilder = new DbContextOptionsBuilder(_options)
                                     .UseSqlCe(_connectionString, b => b.ApplyConfiguration());

                using (var context = new FunkyDataContext(optionsBuilder.Options))
                {
                    context.Database.EnsureClean();
                    FunkyDataModelInitializer.Seed(context);
                }
            }));
        }
        public override FunkyDataContext CreateContext(SqlCeTestStore testStore)
        {
            var options = new DbContextOptionsBuilder(_options)
                          .UseSqlCe(testStore.Connection, b => b.ApplyConfiguration())
                          .Options;

            var context = new FunkyDataContext(options);

            context.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking;

            context.Database.UseTransaction(testStore.Transaction);

            return(context);
        }
示例#4
0
        public override FunkyDataContext CreateContext(SqliteTestStore testStore)
        {
            var optionsBuilder = new DbContextOptionsBuilder()
                                 .UseSqlite(testStore.Connection)
                                 .UseInternalServiceProvider(_serviceProvider);

            var context = new FunkyDataContext(optionsBuilder.Options);

            context.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking;

            context.Database.UseTransaction(testStore.Transaction);

            return(context);
        }
示例#5
0
        public override SqliteTestStore CreateTestStore()
        {
            return(SqliteTestStore.GetOrCreateShared(DatabaseName, () =>
            {
                var optionsBuilder = new DbContextOptionsBuilder()
                                     .UseSqlite(_connectionString)
                                     .UseInternalServiceProvider(_serviceProvider);

                using (var context = new FunkyDataContext(optionsBuilder.Options))
                {
                    context.Database.EnsureClean();
                    FunkyDataModelInitializer.Seed(context);
                }
            }));
        }
        public override FunkyDataContext CreateContext(SqlServerTestStore testStore)
        {
            var optionsBuilder = new DbContextOptionsBuilder();

            optionsBuilder
            .EnableSensitiveDataLogging()
            .UseInternalServiceProvider(_serviceProvider)
            .UseSqlServer(testStore.Connection, b => b.ApplyConfiguration());

            var context = new FunkyDataContext(optionsBuilder.Options);

            context.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking;

            context.Database.UseTransaction(testStore.Transaction);

            return(context);
        }
        public override SqlServerTestStore CreateTestStore()
        {
            return(SqlServerTestStore.GetOrCreateShared(DatabaseName, () =>
            {
                var optionsBuilder = new DbContextOptionsBuilder()
                                     .UseSqlServer(_connectionString, b => b.ApplyConfiguration())
                                     .UseInternalServiceProvider(_serviceProvider);

                using (var context = new FunkyDataContext(optionsBuilder.Options))
                {
                    context.Database.EnsureCreated();
                    FunkyDataModelInitializer.Seed(context);

                    TestSqlLoggerFactory.Reset();
                }
            }));
        }
 protected override void Seed(FunkyDataContext context)
 {
     context.FunkyCustomers.AddRange(NpgsqlFunkyDataData.CreateFunkyCustomers());
     context.SaveChanges();
 }
示例#9
0
 public static void Seed(FunkyDataContext context)
 {
     context.FunkyCustomers.AddRange(FunkyDataData.CreateFunkyCustomers());
     context.SaveChanges();
 }