public static int Main(string[] args) { var connectionString = ConnectionStringFactory.GetConnectionString(args); var isDryRun = args.Contains("dryRun"); var preDeployResult = PerformUpgrade(connectionString, EnvironmentFilter.GetPreDeployFilter(args), isDryRun); if (!preDeployResult.Successful) { return(ResultReporter.ReportResult(preDeployResult)); } ResultReporter.ReportResult(preDeployResult); var result = PerformUpgrade(connectionString, EnvironmentFilter.GetFilter(args), isDryRun); if (!result.Successful) { return(ResultReporter.ReportResult(result)); } ResultReporter.ReportResult(result); var postDeployResult = PerformUpgrade(connectionString, EnvironmentFilter.GetPostDeployFilter(args), isDryRun); return(ResultReporter.ReportResult(postDeployResult)); }
public void Script_is_included_when_parameters_match(bool expectedToRun, string scriptFile, params string[] args) { // Arrange var filter = EnvironmentFilter.GetFilter(args); // Act var actual = filter.Invoke(scriptFile); // Assert actual.Should().Be(expectedToRun); }
public static int Main(string[] args) { var connectionString = ConnectionStringFactory.GetConnectionString(args); var filter = EnvironmentFilter.GetFilter(args); var isDryRun = args.Contains("dryRun"); var upgrader = UpgradeFactory.GetUpgradeEngine(connectionString, filter, isDryRun); var result = upgrader.PerformUpgrade(); return(ResultReporter.ReportResult(result)); }
public void Scripts_are_included_when_parameter_is_added(int expectedNumberOfScriptsIncluded, params string[] args) { // Arrange var filter = EnvironmentFilter.GetFilter(args); var scripts = new[] { "Energinet.DataHub.MarketData.ApplyDBMigrationsApp.Scripts.Model.Script 1.sql", "Energinet.DataHub.MarketData.ApplyDBMigrationsApp.Scripts.Seed.Script 2.sql", "Energinet.DataHub.MarketData.ApplyDBMigrationsApp.Scripts.Test.Script 3.sql", }; // Act var actualNumberOfScriptsIncluded = scripts.Select(script => filter.Invoke(script)) .Where(filtered => filtered) .ToList(); // Assert actualNumberOfScriptsIncluded.Should().HaveCount(expectedNumberOfScriptsIncluded); }