当前位置: 首页>>代码示例>>C#>>正文


C# Controller.ProcessChangeScripts方法代码示例

本文整理汇总了C#中Controller.ProcessChangeScripts方法的典型用法代码示例。如果您正苦于以下问题:C# Controller.ProcessChangeScripts方法的具体用法?C# Controller.ProcessChangeScripts怎么用?C# Controller.ProcessChangeScripts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Controller的用法示例。


在下文中一共展示了Controller.ProcessChangeScripts方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RunIntegratedTestAndConfirmOutputResults

        private void RunIntegratedTestAndConfirmOutputResults(string syntaxName, DirectoryInfo templateDirectory) 
        {
            StringWriter writer = new StringWriter();

            ChangeScript changeOne = new StubChangeScript(1, "001_change.sql", "-- contents of change script 1");
            ChangeScript changeTwo = new StubChangeScript(2, "002_change.sql", "-- contents of change script 2");

            List<ChangeScript> changeScripts = new List<ChangeScript> { changeOne, changeTwo };
            ChangeScriptRepository changeScriptRepository = new ChangeScriptRepository(changeScripts);

            var factory = new DbmsFactory(syntaxName, string.Empty);
            var dbmsSyntax = factory.CreateDbmsSyntax();

            var createChangeLogTable = false;
            StubSchemaManager schemaManager = new StubSchemaManager(dbmsSyntax, createChangeLogTable);

            IChangeScriptApplier applier = new TemplateBasedApplier(writer, dbmsSyntax, "ChangeLog", ";", new NormalDelimiter(), templateDirectory);
            Controller controller = new Controller(changeScriptRepository, schemaManager, applier, null, createChangeLogTable, System.Console.Out);

            controller.ProcessChangeScripts(null);

            var actual = writer.ToString();

            try
            {
                Assert.AreEqual(this.ReadExpectedFileContents(this.GetExpectedFilename(syntaxName)), actual);
            }
            catch (Exception)
            {
                // Output actual template on failure.
                Console.WriteLine("\n\nActual Template ({0}):", syntaxName);
                Console.WriteLine(actual);
                throw;
            }
        }
开发者ID:brunomlopes,项目名称:dbdeploy.net,代码行数:35,代码来源:ScriptGenerationTest.cs

示例2: RunIntegratedTestAndConfirmOutputResults

        private void RunIntegratedTestAndConfirmOutputResults(string syntaxName, DirectoryInfo templateDirectory) 
        {
            var writer = new StringWriter();
            var listReplaces = new List<string>() { "$script.Guid", "$script.Folder", "$script.ScriptNumber", "$script.ScriptName" };
            var listExpecteds = new List<string>()
                {
                    "START CHANGE SCRIPT v1.0/001_change.sql",
                    "END CHANGE SCRIPT v1.0/001_change.sql",
                    "START CHANGE SCRIPT v1.0/002_change.sql",
                    "END CHANGE SCRIPT v1.0/002_change.sql",
                    "INSERT INTO ChangeLog (ChangeId, Folder, ScriptNumber, ScriptName, StartDate, AppliedBy, ScriptStatus, ScriptOutput)",
                    "UPDATE ChangeLog"
                };

            ChangeScript changeOne = new StubChangeScript(1, "001_change.sql", "-- contents of change script 1");
            ChangeScript changeTwo = new StubChangeScript(2, "002_change.sql", "-- contents of change script 2");

            var changeScripts = new List<ChangeScript> { changeOne, changeTwo };
            var changeScriptRepository = new ChangeScriptRepository(changeScripts);

            var factory = new DbmsFactory(syntaxName, string.Empty);
            var dbmsSyntax = factory.CreateDbmsSyntax();

            const bool createChangeLogTable = false;
            var schemaManager = new StubSchemaManager(dbmsSyntax, createChangeLogTable);

            IChangeScriptApplier applier = new TemplateBasedApplier(writer, dbmsSyntax, "ChangeLog", ";", new NormalDelimiter(), templateDirectory);
            var controller = new Controller(new RepositorioScripts(schemaManager,changeScriptRepository), schemaManager, applier, null, createChangeLogTable, Console.Out);

            controller.ProcessChangeScripts(null);

            var actual = writer.ToString();

            try
            {
                var expected = ReadExpectedFileContents(GetExpectedFilename(syntaxName));
                foreach (var currentExpected in listExpecteds)
                {
                    expected.Should().Contain(currentExpected, string.Format("The expected script does not contain {0}", currentExpected));
                }

                foreach (var replace in listReplaces)
                {
                    if (actual.Contains(replace)) 
                        Assert.Fail("A regex from template does not were replaced. \n\rRegex: {0} ", replace);
                }
            }
            catch (Exception)
            {
                // Output actual template on failure.
                Console.WriteLine("\n\nActual Template ({0}):", syntaxName);
                Console.WriteLine(actual);
                throw;
            }
        }
开发者ID:inventti-pedro,项目名称:dbdeploy.net,代码行数:55,代码来源:ScriptGenerationTest.cs

示例3: RunIntegratedTestAndConfirmOutputResults

        private void RunIntegratedTestAndConfirmOutputResults(string syntaxName, DirectoryInfo templateDirectory) 
        {
            StringWriter writer = new StringWriter();

            ChangeScript changeOne = new StubChangeScript(1, "001_change.sql", "-- contents of change script 1");
            ChangeScript changeTwo = new StubChangeScript(2, "002_change.sql", "-- contents of change script 2");

            List<ChangeScript> changeScripts = new List<ChangeScript> { changeOne, changeTwo };
            ChangeScriptRepository changeScriptRepository = new ChangeScriptRepository(changeScripts);

            var factory = new DbmsFactory(syntaxName, string.Empty);

            StubSchemaManager schemaManager = new StubSchemaManager(factory.CreateDbmsSyntax());

            IChangeScriptApplier applier = new TemplateBasedApplier(writer, syntaxName, "changelog", ";", new NormalDelimiter(), templateDirectory);
            Controller controller = new Controller(changeScriptRepository, schemaManager, applier, null, System.Console.Out);

            controller.ProcessChangeScripts(null);

            Assert.AreEqual(this.ReadExpectedFileContents(this.GetExpectedFilename(syntaxName)), writer.ToString());
        }
开发者ID:peschuster,项目名称:dbdeploy.net,代码行数:21,代码来源:ScriptGenerationTest.cs


注:本文中的Controller.ProcessChangeScripts方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。