Esempio n. 1
0
        public void ScriptOrderTestTest()
        {
            var scriptBuilder = new DataMigrationScriptBuilder();

            var beforeScript1 = "Before script 1" + Environment.NewLine + "Before script 1 line 2";
            var beforeScript2 = "Before script 2";

            scriptBuilder.AddBeforeDataMigrationScript(beforeScript1);
            scriptBuilder.AddBeforeDataMigrationScript(beforeScript2);

            var afterScript1 = "After script 1";
            var afterScript2 = "After script 2";

            scriptBuilder.AddAfterDataMigrationScript(afterScript1);
            scriptBuilder.AddAfterDataMigrationScript(afterScript2);

            var dataMigrationScripts = scriptBuilder.GetDataMigrationScripts();

            var beforeDataMigratinScripts = dataMigrationScripts.BeforeDataMigration.ToList();

            Assert.AreEqual(2, beforeDataMigratinScripts.Count);
            Assert.AreEqual(beforeScript1, beforeDataMigratinScripts[0]);
            Assert.AreEqual(beforeScript2, beforeDataMigratinScripts[1]);

            var afterDataMigratinScripts = dataMigrationScripts.AfterDataMigration.ToList();

            Assert.AreEqual(2, afterDataMigratinScripts.Count);
            Assert.AreEqual(afterScript1, afterDataMigratinScripts[0]);
            Assert.AreEqual(afterScript2, afterDataMigratinScripts[1]);
        }
Esempio n. 2
0
        public void EmptyDataMigrationScriptsTest()
        {
            var scriptBuilder = new DataMigrationScriptBuilder();

            var dataMigrationScripts = scriptBuilder.GetDataMigrationScripts();

            Assert.AreEqual(0, dataMigrationScripts.BeforeDataMigration.Count());
            Assert.AreEqual(0, dataMigrationScripts.AfterDataMigration.Count());
        }