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);
        }
Example #6
0
        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>();
 }
Example #9
0
        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;
            }
        }
Example #10
0
        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;
            }
        }