public static FamilyDbContext CreateFamilyDbContext(CreateDbOptions createDbOptions) { // Create new context for all tests var context = new FamilyDbContext(createDbOptions); Assert.True(context.Parents.Count() >= 0); return context; }
public static NorthwindDbContext CreateNorthwindDbContext(CreateDbOptions createDbOptions) { // Create new context for all tests var context = new NorthwindDbContext(createDbOptions); Assert.True(context.Products.Count() >= 0); return context; }
public static NorthwindTestDbContext CreateNorthwindDbContext(CreateDbOptions createDbOptions) { // Create new context for all tests var context = new NorthwindTestDbContext(createDbOptions); Assert.GreaterOrEqual(context.Products.Count(), 0); return context; }
public static FamilyDbContext CreateFamilyDbContext(CreateDbOptions createDbOptions) { // Create new context for all tests var context = new FamilyDbContext(createDbOptions); Assert.True(context.Parents.Count() >= 0); return(context); }
public static NorthwindDbContext CreateNorthwindDbContext(CreateDbOptions createDbOptions) { // Create new context for all tests var context = new NorthwindDbContext(createDbOptions); Assert.True(context.Products.Count() >= 0); return(context); }
static void Main(string[] args) { var options = new CreateDbOptions() { DropDb = true, LoadSeedData = true, LoadTestData = true }; var dbCreator = new Infra.DbCreator(); dbCreator.CreateDb(options); }
public NorthwindDbContext(CreateDbOptions createDbOptions = CreateDbOptions.CreateDatabaseIfNotExists) : base(TestDbName) { switch (createDbOptions) { case CreateDbOptions.DropCreateDatabaseAlways: Database.SetInitializer(new DropCreateDatabaseAlways<NorthwindDbContext>()); break; case CreateDbOptions.DropCreateDatabaseSeed: Database.SetInitializer(new NorthwindDbInitializer()); break; case CreateDbOptions.DropCreateDatabaseIfModelChanges: Database.SetInitializer(new DropCreateDatabaseIfModelChanges<NorthwindDbContext>()); break; default: Database.SetInitializer(new DropCreateDatabaseAlways<NorthwindDbContext>()); break; } }
public FamilyDbContext(CreateDbOptions createDbOptions = CreateDbOptions.CreateDatabaseIfNotExists) : base(TestDbName) { switch (createDbOptions) { case CreateDbOptions.DropCreateDatabaseAlways: Database.SetInitializer(new DropCreateDatabaseAlways<FamilyDbContext>()); break; case CreateDbOptions.DropCreateDatabaseSeed: throw new NotSupportedException("DropCreateDatabaseSeed not supported"); case CreateDbOptions.DropCreateDatabaseIfModelChanges: Database.SetInitializer(new DropCreateDatabaseIfModelChanges<FamilyDbContext>()); break; default: Database.SetInitializer(new CreateDatabaseIfNotExists<FamilyDbContext>()); break; } //Parents = Set<Parent>(); //Children = Set<Child>(); }
public FamilyDbContext(CreateDbOptions createDbOptions = CreateDbOptions.CreateDatabaseIfNotExists) : base(TestDbName) { switch (createDbOptions) { case CreateDbOptions.DropCreateDatabaseAlways: Database.SetInitializer(new DropCreateDatabaseAlways <FamilyDbContext>()); break; case CreateDbOptions.DropCreateDatabaseSeed: throw new NotSupportedException("DropCreateDatabaseSeed not supported"); case CreateDbOptions.DropCreateDatabaseIfModelChanges: Database.SetInitializer(new DropCreateDatabaseIfModelChanges <FamilyDbContext>()); break; default: Database.SetInitializer(new CreateDatabaseIfNotExists <FamilyDbContext>()); break; } }
public NorthwindDbContext(CreateDbOptions createDbOptions = CreateDbOptions.CreateDatabaseIfNotExists) : base(TestDbName) { switch (createDbOptions) { case CreateDbOptions.DropCreateDatabaseAlways: Database.SetInitializer(new DropCreateDatabaseAlways <NorthwindDbContext>()); break; case CreateDbOptions.DropCreateDatabaseSeed: Database.SetInitializer(new NorthwindDbInitializer()); break; case CreateDbOptions.DropCreateDatabaseIfModelChanges: Database.SetInitializer(new DropCreateDatabaseIfModelChanges <NorthwindDbContext>()); break; default: Database.SetInitializer(new DropCreateDatabaseAlways <NorthwindDbContext>()); break; } }