Example #1
0
        public void DoMigrationsFromSqlFileAndClasses()
        {
            TestMigrationContext context = new TestMigrationContext();
            FakeSqlMigrationProcess process = new FakeSqlMigrationProcess();
            SqlScriptMigrationTaskSource taskSource = new SqlScriptMigrationTaskSource();
            process.AddPatchResourceAssembly(typeof(MigrationTask1).Assembly.Location);
            process.AddPatchResourceDirectory(Directory.GetCurrentDirectory() + "\\..\\..");
            process.AddMigrationTaskSource(taskSource);
            process.DoMigrations(0, context);

            // There currently are 2 .NET code and 3 SQL patches for tests
            Assert.IsTrue(context.HasExecuted(new MigrationTask1().Name),
                "MigrationTask1 was supposed to be run");
            Assert.IsTrue(context.HasExecuted(new MigrationTask2().Name),
                "MigrationTask2 was supposed to be run");
            Assert.IsTrue(context.HasExecuted("patch0003_dummy_SQL_file"),
                "patch0003_dummy_SQL_file was supposed to be run");
            Assert.IsTrue(context.HasExecuted("patch0004_fourth_patch"),
                "patch0004_fourth_patch was supposed to be run");
            Assert.IsTrue(context.HasExecuted("patch0005_fifth_patch"),
                "patch0005_fifth_patch was supposed to be run");
        }
Example #2
0
        public void DoMigrationsFromSqlFile()
        {
            TestMigrationContext context = new TestMigrationContext();
            FakeSqlMigrationProcess process = new FakeSqlMigrationProcess();
            SqlScriptMigrationTaskSource taskSource = new SqlScriptMigrationTaskSource();
            process.AddPatchResourceDirectory(Directory.GetCurrentDirectory() + "\\..\\..");
            process.AddMigrationTaskSource(taskSource);
            process.DoMigrations(2, context);

            Assert.IsTrue(context.HasExecuted("patch0003_dummy_SQL_file"),
                "patch0003_dummy_SQL_file was supposed to be run");
            Assert.IsTrue(context.HasExecuted("patch0004_fourth_patch"),
                "patch0004_fourth_patch was supposed to be run");
            Assert.IsTrue(context.HasExecuted("patch0005_fifth_patch"),
                "patch0005_fifth_patch was supposed to be run");
        }