Index: Application/Ringtoets/src/Application.Ringtoets.Migration/Properties/Resources.Designer.cs =================================================================== diff -u -r975f383dbfa3abd403974d4159ae0bc2b0a5dfcd -r1fe151fcfd0dce8fa2c1d93243cae90eee991e70 --- Application/Ringtoets/src/Application.Ringtoets.Migration/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 975f383dbfa3abd403974d4159ae0bc2b0a5dfcd) +++ Application/Ringtoets/src/Application.Ringtoets.Migration/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 1fe151fcfd0dce8fa2c1d93243cae90eee991e70) @@ -84,7 +84,7 @@ /// /// Looks up a localized string similar to /* ---------------------------------------------------- */ ////* Generated by Enterprise Architect Version 12.0 */ - ////* Created On : 31-Jan-2017 10:19:09 */ + ////* Created On : 06-Feb-2017 08:19:11 */ ////* DBMS : SQLite */ ////* ---------------------------------------------------- */ /// @@ -132,7 +132,7 @@ } /// - /// Looks up a localized string similar to Het aanmaken van het Ringtoets bestand versie {0} is mislukt.. + /// Looks up a localized string similar to Het aanmaken van het Ringtoets bestand versie '{0}' is mislukt.. /// public static string RingtoetsCreateScript_Creating_Version_0_Failed { get { @@ -150,7 +150,7 @@ } /// - /// Looks up a localized string similar to Het upgraden van het Ringtoets bestand versie {0} naar {1} is mislukt.. + /// Looks up a localized string similar to Het upgraden van het Ringtoets bestand versie '{0}' naar '{1}' is mislukt.. /// public static string RingtoetsUpgradeScript_Upgrading_Version_0_To_Version_1_Failed { get { Index: Application/Ringtoets/src/Application.Ringtoets.Migration/Properties/Resources.resx =================================================================== diff -u -r975f383dbfa3abd403974d4159ae0bc2b0a5dfcd -r1fe151fcfd0dce8fa2c1d93243cae90eee991e70 --- Application/Ringtoets/src/Application.Ringtoets.Migration/Properties/Resources.resx (.../Resources.resx) (revision 975f383dbfa3abd403974d4159ae0bc2b0a5dfcd) +++ Application/Ringtoets/src/Application.Ringtoets.Migration/Properties/Resources.resx (.../Resources.resx) (revision 1fe151fcfd0dce8fa2c1d93243cae90eee991e70) @@ -128,9 +128,9 @@ Het bestand '{0}' is moet een geldig Ringtoets database bestand zijn. - Het aanmaken van het Ringtoets bestand versie {0} is mislukt. + Het aanmaken van het Ringtoets bestand versie '{0}' is mislukt. - Het upgraden van het Ringtoets bestand versie {0} naar {1} is mislukt. + Het upgraden van het Ringtoets bestand versie '{0}' naar '{1}' is mislukt. \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Migration/RingtoetsCreateScript.cs =================================================================== diff -u -r975f383dbfa3abd403974d4159ae0bc2b0a5dfcd -r1fe151fcfd0dce8fa2c1d93243cae90eee991e70 --- Application/Ringtoets/src/Application.Ringtoets.Migration/RingtoetsCreateScript.cs (.../RingtoetsCreateScript.cs) (revision 975f383dbfa3abd403974d4159ae0bc2b0a5dfcd) +++ Application/Ringtoets/src/Application.Ringtoets.Migration/RingtoetsCreateScript.cs (.../RingtoetsCreateScript.cs) (revision 1fe151fcfd0dce8fa2c1d93243cae90eee991e70) @@ -42,7 +42,7 @@ /// The SQL query that belongs to . /// Thrown when: /// - /// is empty, null, or not a valid Ringtoets database version, + /// is not a valid Ringtoets database version, /// is empty, null, or consist out of only whitespace characters. /// public RingtoetsCreateScript(string version, string query) : base(version) Index: Application/Ringtoets/src/Application.Ringtoets.Migration/RingtoetsUpgradeScript.cs =================================================================== diff -u -r975f383dbfa3abd403974d4159ae0bc2b0a5dfcd -r1fe151fcfd0dce8fa2c1d93243cae90eee991e70 --- Application/Ringtoets/src/Application.Ringtoets.Migration/RingtoetsUpgradeScript.cs (.../RingtoetsUpgradeScript.cs) (revision 975f383dbfa3abd403974d4159ae0bc2b0a5dfcd) +++ Application/Ringtoets/src/Application.Ringtoets.Migration/RingtoetsUpgradeScript.cs (.../RingtoetsUpgradeScript.cs) (revision 1fe151fcfd0dce8fa2c1d93243cae90eee991e70) @@ -43,8 +43,8 @@ /// The SQL query to upgrade from to . /// Thrown when: /// - /// is empty, null, or not a valid Ringtoets database version, - /// is empty, null, or not a valid Ringtoets database version, + /// is not a valid Ringtoets database version, + /// is not a valid Ringtoets database version, /// is empty, null, or consists out of only whitespace characters. /// public RingtoetsUpgradeScript(string fromVersion, string toVersion, string query) Index: Application/Ringtoets/src/Application.Ringtoets.MigrationConsole/Properties/Resources.Designer.cs =================================================================== diff -u -r896b05735de6229ba6108507c79d8207fa3f2d26 -r1fe151fcfd0dce8fa2c1d93243cae90eee991e70 --- Application/Ringtoets/src/Application.Ringtoets.MigrationConsole/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 896b05735de6229ba6108507c79d8207fa3f2d26) +++ Application/Ringtoets/src/Application.Ringtoets.MigrationConsole/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 1fe151fcfd0dce8fa2c1d93243cae90eee991e70) @@ -136,7 +136,7 @@ } /// - /// Looks up a localized string similar to Het projectbestand is niet ondersteund.. + /// Looks up a localized string similar to Het projectbestand wordt niet ondersteund.. /// internal static string CommandSupported_File_Not_Supported { get { @@ -145,7 +145,7 @@ } /// - /// Looks up a localized string similar to Het projectbestand is ondersteund.. + /// Looks up a localized string similar to Het projectbestand wordt ondersteund.. /// internal static string CommandSupported_File_Supported { get { Index: Application/Ringtoets/src/Application.Ringtoets.MigrationConsole/Properties/Resources.resx =================================================================== diff -u -r896b05735de6229ba6108507c79d8207fa3f2d26 -r1fe151fcfd0dce8fa2c1d93243cae90eee991e70 --- Application/Ringtoets/src/Application.Ringtoets.MigrationConsole/Properties/Resources.resx (.../Resources.resx) (revision 896b05735de6229ba6108507c79d8207fa3f2d26) +++ Application/Ringtoets/src/Application.Ringtoets.MigrationConsole/Properties/Resources.resx (.../Resources.resx) (revision 1fe151fcfd0dce8fa2c1d93243cae90eee991e70) @@ -136,10 +136,10 @@ Dit hulpprogramma kan worden gebruikt om een projectbestand in het formaat van een eerdere versie van Ringtoets te migreren naar het formaat van de huidige versie van Ringtoets. - Het projectbestand is ondersteund. + Het projectbestand wordt ondersteund. - Het projectbestand is niet ondersteund. + Het projectbestand wordt niet ondersteund. {0} is geen geldige opdracht. Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Properties/Resources.Designer.cs =================================================================== diff -u -r8e5f037ed7df5263d26ba1ada373be196e7a354b -r1fe151fcfd0dce8fa2c1d93243cae90eee991e70 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 8e5f037ed7df5263d26ba1ada373be196e7a354b) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 1fe151fcfd0dce8fa2c1d93243cae90eee991e70) @@ -84,7 +84,7 @@ /// /// Looks up a localized string similar to /* ---------------------------------------------------- */ ////* Generated by Enterprise Architect Version 12.0 */ - ////* Created On : 20-Jan-2017 8:34:09 AM */ + ////* Created On : 06-Feb-2017 08:19:11 */ ////* DBMS : SQLite */ ////* ---------------------------------------------------- */ /// @@ -102,7 +102,7 @@ ///DROP TABLE IF EXISTS 'StabilityPointStructuresCalculationEntity' ///; /// - ///DROP TABLE IF E [rest of string was truncated]";. + ///DROP TABLE IF EXI [rest of string was truncated]";. /// internal static string DatabaseStructure { get { @@ -225,7 +225,7 @@ } /// - /// Looks up a localized string similar to Ringtoets bestand versie '{0}' is niet valide. Ringtoets bestand versie dient '16.4' of hoger te zijn.. + /// Looks up a localized string similar to Ringtoets bestand versie '{0}' is niet valide. De versie van het Ringtoets projectbestand dient '16.4' of hoger te zijn.. /// internal static string StorageSqLite_ValidateDatabaseVersion_DatabaseVersion_0_is_invalid { get { Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Properties/Resources.resx =================================================================== diff -u -r8e5f037ed7df5263d26ba1ada373be196e7a354b -r1fe151fcfd0dce8fa2c1d93243cae90eee991e70 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Properties/Resources.resx (.../Resources.resx) (revision 8e5f037ed7df5263d26ba1ada373be196e7a354b) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Properties/Resources.resx (.../Resources.resx) (revision 1fe151fcfd0dce8fa2c1d93243cae90eee991e70) @@ -145,7 +145,7 @@ Er bestaat al een tijdelijk bestand ({0}) dat niet verwijderd kan worden. Dit bestand dient handmatig verwijderd te worden. - Ringtoets bestand versie '{0}' is niet valide. Ringtoets bestand versie dient '16.4' of hoger te zijn. + Ringtoets bestand versie '{0}' is niet valide. De versie van het Ringtoets projectbestand dient '16.4' of hoger te zijn. Ringtoets bestand versie '{0}' is hoger dan de huidig ondersteunde versie ('{1}'). Update Ringtoets naar een nieuwere versie. Index: Application/Ringtoets/test/Application.Ringtoets.Migration.Test/RingtoetsCreateScriptTest.cs =================================================================== diff -u -r975f383dbfa3abd403974d4159ae0bc2b0a5dfcd -r1fe151fcfd0dce8fa2c1d93243cae90eee991e70 --- Application/Ringtoets/test/Application.Ringtoets.Migration.Test/RingtoetsCreateScriptTest.cs (.../RingtoetsCreateScriptTest.cs) (revision 975f383dbfa3abd403974d4159ae0bc2b0a5dfcd) +++ Application/Ringtoets/test/Application.Ringtoets.Migration.Test/RingtoetsCreateScriptTest.cs (.../RingtoetsCreateScriptTest.cs) (revision 1fe151fcfd0dce8fa2c1d93243cae90eee991e70) @@ -145,7 +145,7 @@ using (new FileDisposeHelper(filePath)) { CriticalMigrationException exception = Assert.Throws(call); - Assert.AreEqual($"Het aanmaken van het Ringtoets bestand versie {version} is mislukt.", + Assert.AreEqual($"Het aanmaken van het Ringtoets bestand versie '{version}' is mislukt.", exception.Message); Assert.IsInstanceOf(exception.InnerException); } Index: Application/Ringtoets/test/Application.Ringtoets.Migration.Test/RingtoetsUpgradeScriptTest.cs =================================================================== diff -u -r975f383dbfa3abd403974d4159ae0bc2b0a5dfcd -r1fe151fcfd0dce8fa2c1d93243cae90eee991e70 --- Application/Ringtoets/test/Application.Ringtoets.Migration.Test/RingtoetsUpgradeScriptTest.cs (.../RingtoetsUpgradeScriptTest.cs) (revision 975f383dbfa3abd403974d4159ae0bc2b0a5dfcd) +++ Application/Ringtoets/test/Application.Ringtoets.Migration.Test/RingtoetsUpgradeScriptTest.cs (.../RingtoetsUpgradeScriptTest.cs) (revision 1fe151fcfd0dce8fa2c1d93243cae90eee991e70) @@ -122,7 +122,7 @@ using (new FileDisposeHelper(filePath)) { CriticalMigrationException exception = Assert.Throws(call); - Assert.AreEqual($"Het upgraden van het Ringtoets bestand versie {fromVersion} naar {fromVersion} is mislukt.", + Assert.AreEqual($"Het upgraden van het Ringtoets bestand versie '{fromVersion}' naar '{fromVersion}' is mislukt.", exception.Message); Assert.IsInstanceOf(exception.InnerException); } @@ -143,10 +143,8 @@ upgradeScript.Upgrade("c:\\file.ext", filePath); // Assert - using (new FileDisposeHelper(filePath)) - { - Assert.IsTrue(File.Exists(filePath)); - } + Assert.IsTrue(File.Exists(filePath)); + using (new FileDisposeHelper(filePath)) { } } } } \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.MigrationConsole.Test/RingtoetsMigrationConsoleTest.cs =================================================================== diff -u -r32ad96a8c67c5d12fe9c56530c2db04f7b9c8ba9 -r1fe151fcfd0dce8fa2c1d93243cae90eee991e70 --- Application/Ringtoets/test/Application.Ringtoets.MigrationConsole.Test/RingtoetsMigrationConsoleTest.cs (.../RingtoetsMigrationConsoleTest.cs) (revision 32ad96a8c67c5d12fe9c56530c2db04f7b9c8ba9) +++ Application/Ringtoets/test/Application.Ringtoets.MigrationConsole.Test/RingtoetsMigrationConsoleTest.cs (.../RingtoetsMigrationConsoleTest.cs) (revision 1fe151fcfd0dce8fa2c1d93243cae90eee991e70) @@ -57,21 +57,19 @@ { // Setup var console = new RingtoetsMigrationConsole(); - string consoleText; using (var consoleOutput = new ConsoleOutput()) { // Call console.ExecuteConsoleTool(new string[] {}); - consoleText = consoleOutput.GetConsoleOutput(); + // Assert + var expectedText = GetConsoleFullDescription(); + string consoleText = consoleOutput.GetConsoleOutput(); + Assert.AreEqual(expectedText, consoleText); + Assert.AreEqual(ErrorCode.ErrorSuccess, environmentControl.ErrorCodeCalled); } - - // Assert - var expectedText = GetConsoleFullDescription(); - Assert.AreEqual(expectedText, consoleText); - Assert.AreEqual(ErrorCode.ErrorSuccess, environmentControl.ErrorCodeCalled); } [Test] @@ -85,22 +83,20 @@ "1", "2" }; - string consoleText; using (var consoleOutput = new ConsoleOutput()) { // Call console.ExecuteConsoleTool(invalidCommand); - consoleText = consoleOutput.GetConsoleOutput(); + // Assert + var expectedText = $"{string.Join(" ", invalidCommand)} is geen geldige opdracht." + + Environment.NewLine + Environment.NewLine + + GetConsoleFullDescription(); + string consoleText = consoleOutput.GetConsoleOutput(); + Assert.AreEqual(expectedText, consoleText); + Assert.AreEqual(ErrorCode.ErrorBadCommand, environmentControl.ErrorCodeCalled); } - - // Assert - var expectedText = $"{string.Join(" ", invalidCommand)} is geen geldige opdracht." - + Environment.NewLine + Environment.NewLine - + GetConsoleFullDescription(); - Assert.AreEqual(expectedText, consoleText); - Assert.AreEqual(ErrorCode.ErrorBadCommand, environmentControl.ErrorCodeCalled); } [Test] @@ -111,7 +107,7 @@ // Given string sourceFilePath = TestHelper.GetTestDataPath(TestDataPath.Application.Ringtoets.Migration, file); var console = new RingtoetsMigrationConsole(); - string consoleText; + using (var consoleOutput = new ConsoleOutput()) { // When @@ -120,13 +116,12 @@ sourceFilePath }); - consoleText = consoleOutput.GetConsoleOutput(); + // Then + string consoleText = consoleOutput.GetConsoleOutput(); + Assert.AreEqual($@"Het projectbestand wordt {(isSupported ? "" : "niet ")}ondersteund." + + Environment.NewLine, consoleText); + Assert.AreEqual(ErrorCode.ErrorSuccess, environmentControl.ErrorCodeCalled); } - - // Then - Assert.AreEqual($@"Het projectbestand is {(isSupported ? "" : "niet ")}ondersteund." - + Environment.NewLine, consoleText); - Assert.AreEqual(ErrorCode.ErrorSuccess, environmentControl.ErrorCodeCalled); } [Test] @@ -139,7 +134,6 @@ using (new FileDisposeHelper(targetFilePath)) { - string consoleText; using (var consoleOutput = new ConsoleOutput()) { // When @@ -149,16 +143,16 @@ targetFilePath }); - consoleText = consoleOutput.GetConsoleOutput(); - } + // Then + var expected = $"Het bestand '{sourceFilePath}' is succesvol gemigreerd naar '{targetFilePath}'." + + Environment.NewLine; + string consoleText = consoleOutput.GetConsoleOutput(); + Assert.AreEqual(expected, consoleText); - // Then - var expected = $"Het bestand '{sourceFilePath}' is succesvol gemigreerd naar '{targetFilePath}'." - + Environment.NewLine; - Assert.AreEqual(expected, consoleText); - var toVersionedFile = new RingtoetsVersionedFile(targetFilePath); - string expectedVersion = RingtoetsVersionHelper.GetCurrentDatabaseVersion(); - Assert.AreEqual(expectedVersion, toVersionedFile.GetVersion()); + var toVersionedFile = new RingtoetsVersionedFile(targetFilePath); + string expectedVersion = RingtoetsVersionHelper.GetCurrentDatabaseVersion(); + Assert.AreEqual(expectedVersion, toVersionedFile.GetVersion()); + } } Assert.AreEqual(ErrorCode.ErrorSuccess, environmentControl.ErrorCodeCalled); } @@ -172,7 +166,6 @@ var console = new RingtoetsMigrationConsole(); - string consoleText; using (new FileDisposeHelper(targetFilePath)) using (File.Create(targetFilePath)) using (var consoleOutput = new ConsoleOutput()) @@ -184,18 +177,17 @@ targetFilePath }); - consoleText = consoleOutput.GetConsoleOutput(); + // Then + string consoleText = consoleOutput.GetConsoleOutput(); + StringAssert.StartsWith("Er is een onverwachte fout opgetreden tijdens het verplaatsen van het gemigreerde bestand '", + consoleText); + StringAssert.EndsWith($"' naar '{targetFilePath}'." + Environment.NewLine + + "Het besturingssysteem geeft de volgende melding: " + + $"The process cannot access the file '{targetFilePath}' because it is being used by another process." + + Environment.NewLine + Environment.NewLine + + GetConsoleFullDescription(), consoleText); + Assert.AreEqual(ErrorCode.ErrorBadCommand, environmentControl.ErrorCodeCalled); } - - // Then - StringAssert.StartsWith("Er is een onverwachte fout opgetreden tijdens het verplaatsen van het gemigreerde bestand '", - consoleText); - StringAssert.EndsWith($"' naar '{targetFilePath}'." + Environment.NewLine - + "Het besturingssysteem geeft de volgende melding: " - + $"The process cannot access the file '{targetFilePath}' because it is being used by another process." - + Environment.NewLine + Environment.NewLine - + GetConsoleFullDescription(), consoleText); - Assert.AreEqual(ErrorCode.ErrorBadCommand, environmentControl.ErrorCodeCalled); } private static string GetConsoleFullDescription() Index: Application/Ringtoets/test/Application.Ringtoets.MigrationConsole.Test/RingtoetsMigrationToolTest.cs =================================================================== diff -u -r8f4fe5a23ed287cb3e471bbdd276546ef43df392 -r1fe151fcfd0dce8fa2c1d93243cae90eee991e70 --- Application/Ringtoets/test/Application.Ringtoets.MigrationConsole.Test/RingtoetsMigrationToolTest.cs (.../RingtoetsMigrationToolTest.cs) (revision 8f4fe5a23ed287cb3e471bbdd276546ef43df392) +++ Application/Ringtoets/test/Application.Ringtoets.MigrationConsole.Test/RingtoetsMigrationToolTest.cs (.../RingtoetsMigrationToolTest.cs) (revision 1fe151fcfd0dce8fa2c1d93243cae90eee991e70) @@ -111,7 +111,7 @@ } // Then - Assert.AreEqual($@"Het projectbestand is {(isSupported ? "" : "niet ")}ondersteund." + Assert.AreEqual($@"Het projectbestand wordt {(isSupported ? "" : "niet ")}ondersteund." + Environment.NewLine, consoleText); Assert.AreEqual(ErrorCode.ErrorSuccess, environmentControl.ErrorCodeCalled); } Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/StorageSqLiteTest.cs =================================================================== diff -u -r598d038fd4e76b2c75ac49e0d334d2fbc987f876 -r1fe151fcfd0dce8fa2c1d93243cae90eee991e70 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/StorageSqLiteTest.cs (.../StorageSqLiteTest.cs) (revision 598d038fd4e76b2c75ac49e0d334d2fbc987f876) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/StorageSqLiteTest.cs (.../StorageSqLiteTest.cs) (revision 1fe151fcfd0dce8fa2c1d93243cae90eee991e70) @@ -78,7 +78,7 @@ // Assert StorageException exception = Assert.Throws(test); - Assert.AreEqual($@"Fout bij het lezen van bestand '{nonExistingPath}': {"het bestand bestaat niet."}", + Assert.AreEqual($@"Fout bij het lezen van bestand '{nonExistingPath}': het bestand bestaat niet.", exception.Message); } @@ -151,7 +151,7 @@ exception.InnerException.Message); Assert.IsInstanceOf(exception.InnerException.InnerException); - Assert.AreEqual("SQL logic error or missing database" + Environment.NewLine + Assert.AreEqual($"SQL logic error or missing database{Environment.NewLine}" + "no such table: ProjectEntity", exception.InnerException.InnerException.Message); } finally @@ -286,8 +286,8 @@ StorageException exception = Assert.Throws(test); Assert.IsInstanceOf(exception); Assert.AreEqual($@"Fout bij het lezen van bestand '{tempRingtoetsFile}': ringtoets " - + $"bestand versie '{versionCode}' is niet valide. Ringtoets bestand " - + "versie dient '16.4' of hoger te zijn.", exception.Message); + + $"bestand versie '{versionCode}' is niet valide. De versie van het Ringtoets projectbestand " + + "dient '16.4' of hoger te zijn.", exception.Message); } finally { Index: Migration/Console/src/Migration.Console/ConsoleBase.cs =================================================================== diff -u -r896b05735de6229ba6108507c79d8207fa3f2d26 -r1fe151fcfd0dce8fa2c1d93243cae90eee991e70 --- Migration/Console/src/Migration.Console/ConsoleBase.cs (.../ConsoleBase.cs) (revision 896b05735de6229ba6108507c79d8207fa3f2d26) +++ Migration/Console/src/Migration.Console/ConsoleBase.cs (.../ConsoleBase.cs) (revision 1fe151fcfd0dce8fa2c1d93243cae90eee991e70) @@ -127,7 +127,7 @@ { ConsoleHelper.WriteErrorLine(Resources.Message_Inner_Exception_0, exception.InnerException.Message); } - ConsoleHelper.WriteErrorLine(""); + SystemConsole.WriteLine(); } } } \ No newline at end of file Index: Migration/Console/src/Migration.Console/ConsoleHelper.cs =================================================================== diff -u -r56e690b056dd0901609e651f6ac3c010d3d002b7 -r1fe151fcfd0dce8fa2c1d93243cae90eee991e70 --- Migration/Console/src/Migration.Console/ConsoleHelper.cs (.../ConsoleHelper.cs) (revision 56e690b056dd0901609e651f6ac3c010d3d002b7) +++ Migration/Console/src/Migration.Console/ConsoleHelper.cs (.../ConsoleHelper.cs) (revision 1fe151fcfd0dce8fa2c1d93243cae90eee991e70) @@ -66,7 +66,6 @@ /// public static void WriteCommandDescriptionLine(string format, params object[] args) { - const int paddingLeft = 10; const int paddingRight = 1; WriteLineWithPadding(format, args, paddingLeft, paddingRight); Index: Migration/Console/test/Migration.Console.Test/ConsoleBaseTest.cs =================================================================== diff -u -r896b05735de6229ba6108507c79d8207fa3f2d26 -r1fe151fcfd0dce8fa2c1d93243cae90eee991e70 --- Migration/Console/test/Migration.Console.Test/ConsoleBaseTest.cs (.../ConsoleBaseTest.cs) (revision 896b05735de6229ba6108507c79d8207fa3f2d26) +++ Migration/Console/test/Migration.Console.Test/ConsoleBaseTest.cs (.../ConsoleBaseTest.cs) (revision 1fe151fcfd0dce8fa2c1d93243cae90eee991e70) @@ -68,18 +68,16 @@ // Setup var consoleBase = new SimpleConsoleBase(applicationName, applicationDescription); - string consoleText; using (var consoleOutput = new ConsoleOutput()) { // Call consoleBase.WriteDisplayAllCommands(); - consoleText = consoleOutput.GetConsoleOutput(); + // Assert + string consoleText = consoleOutput.GetConsoleOutput(); + Assert.AreEqual(GetConsoleFullDescription(), consoleText); + Assert.AreEqual(ErrorCode.ErrorSuccess, environmentControl.ErrorCodeCalled); } - - // Assert - Assert.AreEqual(GetConsoleFullDescription(), consoleText); - Assert.AreEqual(ErrorCode.ErrorSuccess, environmentControl.ErrorCodeCalled); } [Test] @@ -88,18 +86,16 @@ // Setup var consoleBase = new SimpleConsoleBase(applicationName, applicationDescription); - string consoleText; using (var consoleOutput = new ConsoleOutput()) { // Call consoleBase.SimpleExecuteConsoleTool(null); - consoleText = consoleOutput.GetConsoleOutput(); + // Assert + string consoleText = consoleOutput.GetConsoleOutput(); + Assert.AreEqual(GetConsoleFullDescription(), consoleText); + Assert.AreEqual(ErrorCode.ErrorSuccess, environmentControl.ErrorCodeCalled); } - - // Assert - Assert.AreEqual(GetConsoleFullDescription(), consoleText); - Assert.AreEqual(ErrorCode.ErrorSuccess, environmentControl.ErrorCodeCalled); } [Test] @@ -110,7 +106,6 @@ // Setup var consoleBase = new SimpleConsoleBase(applicationName, applicationDescription); - string consoleText; using (var consoleOutput = new ConsoleOutput()) { // Call @@ -119,12 +114,11 @@ command }); - consoleText = consoleOutput.GetConsoleOutput(); + // Assert + string consoleText = consoleOutput.GetConsoleOutput(); + Assert.AreEqual(GetConsoleFullDescription(), consoleText); + Assert.AreEqual(ErrorCode.ErrorSuccess, environmentControl.ErrorCodeCalled); } - - // Assert - Assert.AreEqual(GetConsoleFullDescription(), consoleText); - Assert.AreEqual(ErrorCode.ErrorSuccess, environmentControl.ErrorCodeCalled); } [Test] @@ -138,82 +132,80 @@ }; var consoleBase = new SimpleConsoleBase(applicationName, applicationDescription); - string consoleText; using (var consoleOutput = new ConsoleOutput()) { // Call - consoleBase.SimpleExecuteConsoleTool(commandArgs); - consoleText = consoleOutput.GetConsoleOutput(); + // Assert + Assert.IsEmpty(consoleOutput.GetConsoleOutput()); + Assert.AreEqual(commandArgs, consoleBase.ExecuteCommandArguments); + Assert.AreEqual(ErrorCode.ErrorSuccess, environmentControl.ErrorCodeCalled); } - - // Assert - Assert.AreEqual("", consoleText); - Assert.AreEqual(commandArgs, consoleBase.ExecuteCommandArguments); - Assert.AreEqual(ErrorCode.ErrorSuccess, environmentControl.ErrorCodeCalled); } [Test] - public void ExecuteConsoleTool_BadCommand_WritesErrorWithErrorCode() + public void ExecuteConsoleTool_ThrowsExceptionWithoutInnerException_WritesErrorWithErrorCode() { // Setup const string command = "invalid command"; + const string exceptionMessage = "I was told to be thrown."; var commandArgs = new[] { command }; var consoleBase = new SimpleConsoleBase(applicationName, applicationDescription); - string consoleText; using (var consoleOutput = new ConsoleOutput()) { - consoleBase.ExceptionToBeThrown = new CriticalMigrationException("I was told to be thrown."); + consoleBase.ExceptionToBeThrown = new CriticalMigrationException(exceptionMessage); // Call consoleBase.SimpleExecuteConsoleTool(commandArgs); - consoleText = consoleOutput.GetConsoleOutput(); - } + // Assert + string expectedtext = exceptionMessage + Environment.NewLine + + Environment.NewLine + GetConsoleFullDescription(); + string consoleText = consoleOutput.GetConsoleOutput(); + Assert.AreEqual(expectedtext, consoleText); - // Assert - string expectedtext = "I was told to be thrown." + Environment.NewLine - + Environment.NewLine + GetConsoleFullDescription(); - Assert.AreEqual(expectedtext, consoleText); - Assert.AreEqual(commandArgs, consoleBase.ExecuteCommandArguments); - Assert.AreEqual(ErrorCode.ErrorBadCommand, environmentControl.ErrorCodeCalled); + Assert.AreEqual(commandArgs, consoleBase.ExecuteCommandArguments); + Assert.AreEqual(ErrorCode.ErrorBadCommand, environmentControl.ErrorCodeCalled); + } } [Test] - public void ExecuteConsoleTool_ThrowsException_WritesErrorWithErrorCode() + public void ExecuteConsoleTool_ThrowsExceptionWithInnerException_WritesErrorsWithErrorCode() { // Setup const string command = "invalid command"; + const string exceptionMessage = "I was told to be thrown."; + const string innerExceptionMessage = "inner exception."; + var commandArgs = new[] { command }; var consoleBase = new SimpleConsoleBase(applicationName, applicationDescription); - string consoleText; using (var consoleOutput = new ConsoleOutput()) { - consoleBase.ExceptionToBeThrown = new Exception("I was told to be thrown.", new Exception("inner exception.")); + consoleBase.ExceptionToBeThrown = new Exception(exceptionMessage, new Exception(innerExceptionMessage)); // Call consoleBase.SimpleExecuteConsoleTool(commandArgs); - consoleText = consoleOutput.GetConsoleOutput(); - } + // Assert + string expectedtext = exceptionMessage + Environment.NewLine + + $"Het besturingssysteem geeft de volgende melding: {innerExceptionMessage}" + + Environment.NewLine + Environment.NewLine + + GetConsoleFullDescription(); + string consoleText = consoleOutput.GetConsoleOutput(); + Assert.AreEqual(expectedtext, consoleText); - // Assert - string expectedtext = "I was told to be thrown." + Environment.NewLine - + "Het besturingssysteem geeft de volgende melding: inner exception." - + Environment.NewLine + Environment.NewLine - + GetConsoleFullDescription(); - Assert.AreEqual(expectedtext, consoleText); - Assert.AreEqual(commandArgs, consoleBase.ExecuteCommandArguments); - Assert.AreEqual(ErrorCode.ErrorInvalidCommandLine, environmentControl.ErrorCodeCalled); + Assert.AreEqual(commandArgs, consoleBase.ExecuteCommandArguments); + Assert.AreEqual(ErrorCode.ErrorInvalidCommandLine, environmentControl.ErrorCodeCalled); + } } private static string GetConsoleFullDescription() Index: Migration/Core/src/Migration.Core.Storage/VersionedFileMigrator.cs =================================================================== diff -u -r07a4c17cb2948b949a6bad40dacb211b48d428a3 -r1fe151fcfd0dce8fa2c1d93243cae90eee991e70 --- Migration/Core/src/Migration.Core.Storage/VersionedFileMigrator.cs (.../VersionedFileMigrator.cs) (revision 07a4c17cb2948b949a6bad40dacb211b48d428a3) +++ Migration/Core/src/Migration.Core.Storage/VersionedFileMigrator.cs (.../VersionedFileMigrator.cs) (revision 1fe151fcfd0dce8fa2c1d93243cae90eee991e70) @@ -164,31 +164,31 @@ } catch (Exception exception) when (exception is IOException || exception is UnauthorizedAccessException) { - var message = string.Format(Resources.Migrate_Unable_To_Move_From_Location_0_To_Location_1, - sourceFileName, destinationFileName); + string message = string.Format(Resources.Migrate_Unable_To_Move_From_Location_0_To_Location_1, + sourceFileName, destinationFileName); throw new CriticalMigrationException(message, exception); } } private FileMigrationScript GetMigrationScript(string fromVersion, string toVersion) { - var supportedMigrationScripts = fileMigrationScripts.Where(ms => ms.SupportedVersion() - .Equals(fromVersion)); + IEnumerable supportedMigrationScripts = fileMigrationScripts.Where(ms => ms.SupportedVersion() + .Equals(fromVersion)); return supportedMigrationScripts.FirstOrDefault(ms => ms.TargetVersion().Equals(toVersion)) ?? supportedMigrationScripts.FirstOrDefault(ms => versionedFileComparer.Compare(toVersion, ms.TargetVersion()) > 0); } private IEnumerable GetAvailableMigrations() { - IEnumerable migrationStreams = GetAvailableUpgradeScripts(); + IEnumerable upgradeScripts = GetAvailableUpgradeScripts(); - foreach (var migrationScript in migrationStreams) + foreach (UpgradeScript upgradeScript in upgradeScripts) { - CreateScript createScript = GetAvailableCreateScripts().FirstOrDefault(cs => cs.GetVersion().Equals(migrationScript.ToVersion())); + CreateScript createScript = GetAvailableCreateScripts().FirstOrDefault(cs => cs.GetVersion().Equals(upgradeScript.ToVersion())); if (createScript != null) { - yield return new FileMigrationScript(createScript, migrationScript); + yield return new FileMigrationScript(createScript, upgradeScript); } } } Index: Migration/Core/test/Migration.Core.Storage.TestUtil.Test/TestVersionedFileMigratorTest.cs =================================================================== diff -u -r0b35a52e397b25ca20160dbd1bd4e53403d1bc63 -r1fe151fcfd0dce8fa2c1d93243cae90eee991e70 --- Migration/Core/test/Migration.Core.Storage.TestUtil.Test/TestVersionedFileMigratorTest.cs (.../TestVersionedFileMigratorTest.cs) (revision 0b35a52e397b25ca20160dbd1bd4e53403d1bc63) +++ Migration/Core/test/Migration.Core.Storage.TestUtil.Test/TestVersionedFileMigratorTest.cs (.../TestVersionedFileMigratorTest.cs) (revision 1fe151fcfd0dce8fa2c1d93243cae90eee991e70) @@ -87,10 +87,11 @@ var mockRepository = new MockRepository(); var comparer = mockRepository.Stub(); mockRepository.ReplayAll(); - - // Call + IEnumerable upgradeScripts = Enumerable.Empty(); IEnumerable createScripts = Enumerable.Empty(); + + // Call var migrator = new SimpleTestVersionedFileMigrator(comparer, upgradeScripts, createScripts); Index: Migration/Scripts/test/Migration.Scripts.Data.Test/UpgradeScriptTest.cs =================================================================== diff -u -radb7a69497e2221e75420ccf5f5d7407321870dd -r1fe151fcfd0dce8fa2c1d93243cae90eee991e70 --- Migration/Scripts/test/Migration.Scripts.Data.Test/UpgradeScriptTest.cs (.../UpgradeScriptTest.cs) (revision adb7a69497e2221e75420ccf5f5d7407321870dd) +++ Migration/Scripts/test/Migration.Scripts.Data.Test/UpgradeScriptTest.cs (.../UpgradeScriptTest.cs) (revision 1fe151fcfd0dce8fa2c1d93243cae90eee991e70) @@ -73,7 +73,7 @@ [TestCase("")] [TestCase(" ")] [TestCase(null)] - public void Upgrade_SourceNull_ThrowsArgumentException(string sourceFilePath) + public void Upgrade_InvalidSourceFilePath_ThrowsArgumentException(string sourceFilePath) { // Setup const string fromVersion = "fromVersion"; @@ -91,7 +91,7 @@ [TestCase("")] [TestCase(" ")] [TestCase(null)] - public void Upgrade_TargetNull_ThrowsArgumentException(string targetFilePath) + public void Upgrade_InvalidTargetFilePath_ThrowsArgumentException(string targetFilePath) { // Setup const string fromVersion = "fromVersion";