Example #1
0
        public void DoMigrationsFromLevelOne()
        {
            TestMigrationContext context = new TestMigrationContext();
            MigrationProcess process = new MigrationProcess();
            //process.AddPatchResourceAssembly(typeof(MigrationTask1).Assembly.CodeBase);
            process.AddPatchResourceAssembly(typeof(MigrationTask1).Assembly.Location);
            process.DoMigrations(1, context);

            Assert.IsFalse(context.HasExecuted(new MigrationTask1().Name), "MigrationTask1 was not supposed to be run");
            Assert.IsTrue(context.HasExecuted(new MigrationTask2().Name), "MigrationTask2 was supposed to be run");
        }
Example #2
0
        public void DoMigrationsFromLevelOneHundred()
        {
            TestMigrationContext context = new TestMigrationContext();
            MigrationProcess process = new MigrationProcess();
            //process.AddPatchResourceAssembly(typeof(MigrationTask1).Assembly.CodeBase);
            process.AddPatchResourceAssembly(typeof(MigrationTask1).Assembly.Location);
            int count = process.DoMigrations(100, context);

            Assert.IsTrue(0 == count, "No migration tasks were supposed to be run on an up-to-date system");
            Assert.IsFalse(context.HasExecuted(new MigrationTask1().Name), "MigrationTask1 was not supposed to be run");
            Assert.IsFalse(context.HasExecuted(new MigrationTask2().Name), "MigrationTask2 was not supposed to be run");
        }
Example #3
0
        public void DoMigrationsFromLevelOneHundredReadOnly()
        {
            TestMigrationContext context = new TestMigrationContext();
            MigrationProcess process = new MigrationProcess();
            //process.AddPatchResourceAssembly(typeof(MigrationTask1).Assembly.CodeBase);
            process.AddPatchResourceAssembly(typeof(MigrationTask1).Assembly.Location);
            process.ReadOnly = true;
            int count = process.DoMigrations(100, context);

            Assert.AreEqual(0, count, "No migration tasks were supposed to be run on an up-to-date system in readonly mode");
            Assert.AreEqual(0, context.ExecutionLog.Count, "The execution log should not have recorded anything in readonly mode");
        }
Example #4
0
        public void DoMigrationsFromLevelOneReadOnly()
        {
            TestMigrationContext context = new TestMigrationContext();
            MigrationProcess process = new MigrationProcess();
            //process.AddPatchResourceAssembly(typeof(MigrationTask1).Assembly.CodeBase);
            process.AddPatchResourceAssembly(typeof(MigrationTask1).Assembly.Location);
            process.ReadOnly = true;

            int count = -1;

            try
            {
                count = process.DoMigrations(1, context);
            }
            catch (MigrationException me)
            {
                Assert.AreEqual(-1, count, "No migration tasks were supposed to be run in readonly mode");
                Assert.AreEqual(0, context.ExecutionLog.Count, "The execution log should not have recorded anything in readonly mode");
                throw me;
            }
        }