public void GetScriptsFilesFolderShouldReturnDefaultWhenScriptFilesFolderIsNotSet() { var parsedArguments = new ParsedArguments(); var r = parsedArguments.GetScriptFilesFolderOrDefaultFolder(); Assert.That(r, Is.EqualTo(ParsedArguments.ScriptFilesFolderDefault)); }
public void GetScriptsFilesFolderShouldReturnScriptFolderWhenScriptFolderPopulated() { var parsedArguments = new ParsedArguments(); parsedArguments.SetValue(CommandlineSwitchType.ScriptFiles, "c:\\foo"); var r = parsedArguments.GetScriptFilesFolderOrDefaultFolder(); Assert.That(r, Is.EqualTo("c:\\foo")); }
public static void Main(string[] args) { try { var commandLineArgumentsParser = new CommandLineArgumentsParser(); ParsedArguments parsedArguments = commandLineArgumentsParser.ParseArgs(args); var printScreenFactory = new PrintScreenFactory(); var config = new CommandLineArgsConfiguration(parsedArguments); var factory = new DbmsFactory(config.DbType, config.DbConnectionString); var databaseSchemaVersion = new DatabaseSchemaVersionManager(factory, config.DbDeltaSet, config.CurrentDbVersion, config.TableName, config.ChangeOwner); var directoryInfo = new DirectoryInfo(parsedArguments.GetScriptFilesFolderOrDefaultFolder()); TextWriter outputPrintStream = printScreenFactory.GetDoPrintStream(parsedArguments); var dbmsSyntax = factory.CreateDbmsSyntax(config.ChangeOwner); var useTransaction = config.UseTransaction; TextWriter undoOutputPrintStream = printScreenFactory.GetUndoPrintStream(parsedArguments); var toPrintStreamDeployer = new ToPrintStreamDeployer(databaseSchemaVersion, directoryInfo, outputPrintStream, dbmsSyntax, useTransaction, undoOutputPrintStream); toPrintStreamDeployer.DoDeploy(LastVersionChangeToApply); printScreenFactory.ClosePrintStream(outputPrintStream); printScreenFactory.ClosePrintStream(undoOutputPrintStream); } catch (DbDeployException ex) { Console.Error.WriteLine(ex.Message); Environment.Exit(1); } catch (Exception ex) { Console.Error.WriteLine("Failed to apply changes: " + ex); Console.Error.WriteLine(ex.StackTrace); Environment.Exit(2); } }