Exemplo n.º 1
0
        public void Test03_Initialize_Database_Using_DropCreateDatabaseAlways_Without_DataSeeder()
        {
            var dbContext   = new FakeDbContext();
            var initialiser = new DropCreateDatabaseAlways();

            initialiser.Initialize(dbContext);

            dbContext.ensureCreatedCalled.Should().BeTrue();
            dbContext.ensureDeletedCalled.Should().BeTrue();
        }
Exemplo n.º 2
0
        public void Test06_Initialize_Database_Using_DropCreateDatabaseAlways_With_DataSeeder_For_Existing_Database()
        {
            var dbContext      = new AnotherFakeDbContext();
            var dataSeederMock = new Mock <IDataSeeder>();

            var initialiser = new DropCreateDatabaseAlways(dataSeederMock.Object);

            initialiser.Initialize(dbContext);

            dbContext.ensureCreatedCalled.Should().BeTrue();
            dbContext.ensureDeletedCalled.Should().BeTrue();

            dataSeederMock.Verify(m => m.Seed(It.IsAny <DbContext>()), Times.Never);
        }