本文整理汇总了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;
}
}
示例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;
}
}
示例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());
}