public void ReadModelDbContext_drops_the_database_and_recreates_it_when_the_prior_version_has_no_migrations()
        {
            // arrange
            Database.SetInitializer(new DropCreateDatabaseAlways <MigrationsTestReadModels>());

            using (var db = new MigrationsTestReadModels(
                       typeof(OrderTallyEntityModelConfiguration)))
            {
                db.Database.Initialize(true);

                db.Set <OrderTally>().Add(new OrderTally
                {
                    Count  = 1,
                    Status = Any.Word()
                });

                db.SaveChanges();

                db.Set <OrderTally>().Count().Should().Be(1);
            }

            Database.SetInitializer(new ReadModelDatabaseInitializer <MigrationsTestReadModels>(new Version("1.1")));

            using (var db = new MigrationsTestReadModels(
                       typeof(OrderTallyEntityModelConfiguration)))
            {
                // act
                db.Database.Initialize(true);

                // assert
                db.Set <OrderTally>().Count().Should().Be(0);
            }
        }
        public void ReadModelDbContext_drops_the_database_and_recreates_it_when_the_schema_has_changed()
        {
            // arrange
            Database.SetInitializer(new ReadModelDatabaseInitializer <MigrationsTestReadModels>());

            using (var db = new MigrationsTestReadModels(
                       typeof(OrderTallyEntityModelConfiguration)))
            {
                db.Database.Initialize(true);

                db.Set <OrderTally>().Add(new OrderTally
                {
                    Count  = 1,
                    Status = Any.Word()
                });

                db.SaveChanges();

                db.Set <OrderTally>().Count().Should().Be(1);
            }

            using (var db = new MigrationsTestReadModels(
                       typeof(OrderTallyEntityModelConfiguration),
                       typeof(ProductInventoryEntityModelConfiguration)))
            {
                // act
                db.Database.Initialize(true);

                // assert
                db.Set <OrderTally>().Count().Should().Be(0);
                db.Set <ProductInventory>().Count().Should().Be(0);
            }
        }