상속: ILogger
예제 #1
0
        public void ItShouldNotApplyMigrationsSinceLastVersionWhenVersionBiggerThanMigration()
        {
            var database = new DatabaseStub(3);
            var logger = new LoggerStub();
            var schema = new Schema(database, logger);
            var migrator = new Migrator(schema, typeof(FirstMigration).Assembly, logger);

            migrator.MigrateToLatest();

            Assert.That(database.Statements.Any(x => x.Contains("FirstMigration")), Is.False);
        }
예제 #2
0
        public void ItShouldFindFirstMigrationInAssembly()
        {
            var database = new DatabaseStub();
            var logger = new LoggerStub();
            var schema = new Schema(database, logger);
            var migrator = new Migrator(schema, typeof(FirstMigration).Assembly, logger);

            migrator.MigrateToLatest();

            Assert.That(logger.Logs.Any(x => x.Contains(@"Found 1 Migrations")));
        }
예제 #3
0
        public void ItShouldInformIfNoMigrationsFoundInAssembly()
        {
            var database = new DatabaseStub();
            var logger = new LoggerStub();
            var schema = new Schema(database, logger);
            var migrator = new Migrator(schema, typeof (Schema).Assembly, logger);

            migrator.MigrateToLatest();

            Assert.That(logger.Logs.Any(x=>x.Contains(@"No Migrations Found")));
        }
예제 #4
0
        public void ItShouldApplyMigrationsSinceLastVersionAndUpdateSchemaTable()
        {
            var database = new DatabaseStub();
            var logger = new LoggerStub();
            var schema = new Schema(database, logger);
            var migrator = new Migrator(schema, typeof(FirstMigration).Assembly, logger);

            migrator.MigrateToLatest();

            Assert.That(database.Statements.Any(x => x.Contains("FirstMigration")));
        }
예제 #5
0
        public void ItShouldNotUpdateSchemaVersionTo1IfMigrationNotApplicable()
        {
            var database = new DatabaseStub(3);
            var logger = new LoggerStub();
            var schema = new Schema(database, logger);
            var migrator = new Migrator(schema, typeof(FirstMigration).Assembly, logger);

            migrator.MigrateToLatest();

            Assert.That(database.Statements.Any(x => x.Contains(@"INSERT INTO [dbo].[SchemaInfo]
               ([Version])
             VALUES
               (1)")), Is.False);
        }