Index: Application/Ringtoets/src/Application.Ringtoets.MigrationConsole/Properties/Resources.Designer.cs =================================================================== diff -u -r1fe151fcfd0dce8fa2c1d93243cae90eee991e70 -r369c682fee14bf5c99b2a11f8d61f8a529bae459 --- Application/Ringtoets/src/Application.Ringtoets.MigrationConsole/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 1fe151fcfd0dce8fa2c1d93243cae90eee991e70) +++ Application/Ringtoets/src/Application.Ringtoets.MigrationConsole/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 369c682fee14bf5c99b2a11f8d61f8a529bae459) @@ -109,11 +109,11 @@ } /// - /// Looks up a localized string similar to Het bestand '{0}' is succesvol gemigreerd naar '{1}'.. + /// Looks up a localized string similar to Het bestand '{0}' is succesvol gemigreerd naar '{1}' (versie '{2}').. /// - internal static string CommandMigrate_Successful_Migration_From_Location_0_To_Location_1 { + internal static string CommandMigrate_Successful_Migration_From_Location_0_To_Location_1_Version_2 { get { - return ResourceManager.GetString("CommandMigrate_Successful_Migration_From_Location_0_To_Location_1", resourceCulture); + return ResourceManager.GetString("CommandMigrate_Successful_Migration_From_Location_0_To_Location_1_Version_2", resourceCulture); } } @@ -136,20 +136,20 @@ } /// - /// Looks up a localized string similar to Het projectbestand wordt niet ondersteund.. + /// Looks up a localized string similar to Het projectbestand kan gemigreerd worden naar versie '{0}'.. /// - internal static string CommandSupported_File_Not_Supported { + internal static string CommandSupported_File_Able_To_Migrate_To_Version_0 { get { - return ResourceManager.GetString("CommandSupported_File_Not_Supported", resourceCulture); + return ResourceManager.GetString("CommandSupported_File_Able_To_Migrate_To_Version_0", resourceCulture); } } /// - /// Looks up a localized string similar to Het projectbestand wordt ondersteund.. + /// Looks up a localized string similar to Het projectbestand kan niet gemigreerd worden naar versie '{0}'.. /// - internal static string CommandSupported_File_Supported { + internal static string CommandSupported_File_Not_Able_To_Migrate_To_Version_0 { get { - return ResourceManager.GetString("CommandSupported_File_Supported", resourceCulture); + return ResourceManager.GetString("CommandSupported_File_Not_Able_To_Migrate_To_Version_0", resourceCulture); } } Index: Application/Ringtoets/src/Application.Ringtoets.MigrationConsole/Properties/Resources.resx =================================================================== diff -u -r1fe151fcfd0dce8fa2c1d93243cae90eee991e70 -r369c682fee14bf5c99b2a11f8d61f8a529bae459 --- Application/Ringtoets/src/Application.Ringtoets.MigrationConsole/Properties/Resources.resx (.../Resources.resx) (revision 1fe151fcfd0dce8fa2c1d93243cae90eee991e70) +++ Application/Ringtoets/src/Application.Ringtoets.MigrationConsole/Properties/Resources.resx (.../Resources.resx) (revision 369c682fee14bf5c99b2a11f8d61f8a529bae459) @@ -123,8 +123,8 @@ Voert de migratie uit van het projectbestand dat te vinden is in het bronprojectpad en slaat het resulterende projectbestand op in het doelprojectpad. - - Het bestand '{0}' is succesvol gemigreerd naar '{1}'. + + Het bestand '{0}' is succesvol gemigreerd naar '{1}' (versie '{2}'). MIGRATIEHULPPROGRAMMA bronprojectpad @@ -135,11 +135,11 @@ 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 wordt ondersteund. + + Het projectbestand kan gemigreerd worden naar versie '{0}'. - - Het projectbestand wordt niet ondersteund. + + Het projectbestand kan niet gemigreerd worden naar versie '{0}'. {0} is geen geldige opdracht. Index: Application/Ringtoets/src/Application.Ringtoets.MigrationConsole/RingtoetsMigrationConsole.cs =================================================================== diff -u -rc2d1014f9ad458166d0ccad5800da9f674a8152a -r369c682fee14bf5c99b2a11f8d61f8a529bae459 --- Application/Ringtoets/src/Application.Ringtoets.MigrationConsole/RingtoetsMigrationConsole.cs (.../RingtoetsMigrationConsole.cs) (revision c2d1014f9ad458166d0ccad5800da9f674a8152a) +++ Application/Ringtoets/src/Application.Ringtoets.MigrationConsole/RingtoetsMigrationConsole.cs (.../RingtoetsMigrationConsole.cs) (revision 369c682fee14bf5c99b2a11f8d61f8a529bae459) @@ -72,9 +72,11 @@ var version = versionedFile.GetVersion(); bool isSupported = migrator.IsVersionSupported(version); + + string toVersion = RingtoetsVersionHelper.GetCurrentDatabaseVersion(); Console.WriteLine(isSupported - ? Resources.CommandSupported_File_Supported - : Resources.CommandSupported_File_Not_Supported); + ? Resources.CommandSupported_File_Able_To_Migrate_To_Version_0 + : Resources.CommandSupported_File_Not_Able_To_Migrate_To_Version_0, toVersion); } private static void ShowSupportedCommand() @@ -91,8 +93,8 @@ var sourceFile = new RingtoetsVersionedFile(filepath); migrator.Migrate(sourceFile, toVersion, toFilepath); - Console.WriteLine(Resources.CommandMigrate_Successful_Migration_From_Location_0_To_Location_1, - filepath, toFilepath); + Console.WriteLine(Resources.CommandMigrate_Successful_Migration_From_Location_0_To_Location_1_Version_2, + filepath, toFilepath, toVersion); } private static void ShowMigrateCommand() Index: Application/Ringtoets/test/Application.Ringtoets.MigrationConsole.Test/RingtoetsMigrationConsoleTest.cs =================================================================== diff -u -r945456b6d565dafb7f55bbb8321e435002480839 -r369c682fee14bf5c99b2a11f8d61f8a529bae459 --- Application/Ringtoets/test/Application.Ringtoets.MigrationConsole.Test/RingtoetsMigrationConsoleTest.cs (.../RingtoetsMigrationConsoleTest.cs) (revision 945456b6d565dafb7f55bbb8321e435002480839) +++ Application/Ringtoets/test/Application.Ringtoets.MigrationConsole.Test/RingtoetsMigrationConsoleTest.cs (.../RingtoetsMigrationConsoleTest.cs) (revision 369c682fee14bf5c99b2a11f8d61f8a529bae459) @@ -65,7 +65,7 @@ {}); // Assert - var expectedText = GetConsoleFullDescription(); + var expectedText = Environment.NewLine + GetConsoleFullDescription(); string consoleText = consoleOutput.GetConsoleOutput(); Assert.AreEqual(expectedText, consoleText); Assert.AreEqual(ErrorCode.ErrorSuccess, environmentControl.ErrorCodeCalled); @@ -90,7 +90,8 @@ console.ExecuteConsoleTool(invalidCommand); // Assert - var expectedText = $"{string.Join(" ", invalidCommand)} is geen geldige opdracht." + var expectedText = Environment.NewLine + + $"{string.Join(" ", invalidCommand)} is geen geldige opdracht." + Environment.NewLine + Environment.NewLine + GetConsoleFullDescription(); string consoleText = consoleOutput.GetConsoleOutput(); @@ -107,6 +108,7 @@ // Given string sourceFilePath = TestHelper.GetTestDataPath(TestDataPath.Application.Ringtoets.Migration, file); var console = new RingtoetsMigrationConsole(); + string expectedVersion = RingtoetsVersionHelper.GetCurrentDatabaseVersion(); using (var consoleOutput = new ConsoleOutput()) { @@ -118,7 +120,8 @@ // Then string consoleText = consoleOutput.GetConsoleOutput(); - Assert.AreEqual($@"Het projectbestand wordt {(isSupported ? "" : "niet ")}ondersteund." + Assert.AreEqual(Environment.NewLine + + $@"Het projectbestand kan {(isSupported ? "" : "niet ")}gemigreerd worden naar versie '{expectedVersion}'." + Environment.NewLine, consoleText); Assert.AreEqual(ErrorCode.ErrorSuccess, environmentControl.ErrorCodeCalled); } @@ -131,6 +134,7 @@ string sourceFilePath = TestHelper.GetTestDataPath(TestDataPath.Application.Ringtoets.Migration, "FullTestProject164.rtd"); string targetFilePath = TestHelper.GetTestDataPath(TestDataPath.Application.Ringtoets.Migration, Path.GetRandomFileName()); var console = new RingtoetsMigrationConsole(); + string expectedVersion = RingtoetsVersionHelper.GetCurrentDatabaseVersion(); using (new FileDisposeHelper(targetFilePath)) { @@ -144,13 +148,13 @@ }); // Then - var expected = $"Het bestand '{sourceFilePath}' is succesvol gemigreerd naar '{targetFilePath}'." + var expected = Environment.NewLine + + $"Het bestand '{sourceFilePath}' is succesvol gemigreerd naar '{targetFilePath}' (versie '{expectedVersion}')." + Environment.NewLine; string consoleText = consoleOutput.GetConsoleOutput(); Assert.AreEqual(expected, consoleText); var toVersionedFile = new RingtoetsVersionedFile(targetFilePath); - string expectedVersion = RingtoetsVersionHelper.GetCurrentDatabaseVersion(); Assert.AreEqual(expectedVersion, toVersionedFile.GetVersion()); } } @@ -180,7 +184,7 @@ // Then string consoleText = consoleOutput.GetConsoleOutput(); - StringAssert.StartsWith("Er is een onverwachte fout opgetreden tijdens het verplaatsen van het gemigreerde bestand '", + StringAssert.StartsWith(Environment.NewLine + "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: " Index: Application/Ringtoets/test/Application.Ringtoets.MigrationConsole.Test/RingtoetsMigrationToolTest.cs =================================================================== diff -u -r945456b6d565dafb7f55bbb8321e435002480839 -r369c682fee14bf5c99b2a11f8d61f8a529bae459 --- Application/Ringtoets/test/Application.Ringtoets.MigrationConsole.Test/RingtoetsMigrationToolTest.cs (.../RingtoetsMigrationToolTest.cs) (revision 945456b6d565dafb7f55bbb8321e435002480839) +++ Application/Ringtoets/test/Application.Ringtoets.MigrationConsole.Test/RingtoetsMigrationToolTest.cs (.../RingtoetsMigrationToolTest.cs) (revision 369c682fee14bf5c99b2a11f8d61f8a529bae459) @@ -34,6 +34,7 @@ public class RingtoetsMigrationToolTest { private TestEnvironmentControl environmentControl; + private readonly TestDataPath testPath = TestDataPath.Application.Ringtoets.Migration; [SetUp] public void SetUp() @@ -45,22 +46,18 @@ [Test] public void Main_NoArguments_WritesHelpToConsole() { - // Setup - string consoleText; - // Call using (var consoleOutput = new ConsoleOutput()) { RingtoetsMigrationTool.Main(new string[] {}); - consoleText = consoleOutput.GetConsoleOutput(); + // Assert + string consoleText = consoleOutput.GetConsoleOutput(); + var expectedText = Environment.NewLine + GetConsoleFullDescription(); + 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] @@ -73,22 +70,22 @@ "1", "2" }; - string consoleText; // Call using (var consoleOutput = new ConsoleOutput()) { RingtoetsMigrationTool.Main(invalidCommand); - consoleText = consoleOutput.GetConsoleOutput(); - } + // Assert + string consoleText = consoleOutput.GetConsoleOutput(); - // 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); + var expectedText = Environment.NewLine + + $"{string.Join(" ", invalidCommand)} is geen geldige opdracht." + + Environment.NewLine + Environment.NewLine + + GetConsoleFullDescription(); + Assert.AreEqual(expectedText, consoleText); + Assert.AreEqual(ErrorCode.ErrorBadCommand, environmentControl.ErrorCodeCalled); + } } [Test] @@ -97,8 +94,8 @@ public void GivenConsole_WhenVersionSupportedCall_ThenReturnedIfSupported(string file, bool isSupported) { // Given - string sourceFilePath = TestHelper.GetTestDataPath(TestDataPath.Application.Ringtoets.Migration, file); - string consoleText; + string sourceFilePath = TestHelper.GetTestDataPath(testPath, file); + string expectedVersion = RingtoetsVersionHelper.GetCurrentDatabaseVersion(); using (var consoleOutput = new ConsoleOutput()) { // When @@ -107,25 +104,25 @@ sourceFilePath }); - consoleText = consoleOutput.GetConsoleOutput(); + // Then + string consoleText = consoleOutput.GetConsoleOutput(); + Assert.AreEqual(Environment.NewLine + $@"Het projectbestand kan {(isSupported ? "" : "niet ")}" + + $"gemigreerd worden naar versie '{expectedVersion}'." + + Environment.NewLine, consoleText); + Assert.AreEqual(ErrorCode.ErrorSuccess, environmentControl.ErrorCodeCalled); } - - // Then - Assert.AreEqual($@"Het projectbestand wordt {(isSupported ? "" : "niet ")}ondersteund." - + Environment.NewLine, consoleText); - Assert.AreEqual(ErrorCode.ErrorSuccess, environmentControl.ErrorCodeCalled); } [Test] public void GivenConsole_WhenMigrateCalledWithArguments_MigratesToNewVersion() { // Given - string sourceFilePath = TestHelper.GetTestDataPath(TestDataPath.Application.Ringtoets.Migration, "FullTestProject164.rtd"); - string targetFilePath = TestHelper.GetTestDataPath(TestDataPath.Application.Ringtoets.Migration, Path.GetRandomFileName()); + string sourceFilePath = TestHelper.GetTestDataPath(testPath, "FullTestProject164.rtd"); + string targetFilePath = TestHelper.GetTestDataPath(testPath, Path.GetRandomFileName()); + string expectedVersion = RingtoetsVersionHelper.GetCurrentDatabaseVersion(); using (new FileDisposeHelper(targetFilePath)) { - string consoleText; using (var consoleOutput = new ConsoleOutput()) { // When @@ -135,16 +132,16 @@ targetFilePath }); - consoleText = consoleOutput.GetConsoleOutput(); + // Then + string consoleText = consoleOutput.GetConsoleOutput(); + var expected = Environment.NewLine + + $"Het bestand '{sourceFilePath}' is succesvol gemigreerd naar " + + $"'{targetFilePath}' (versie '{expectedVersion}')." + + Environment.NewLine; + Assert.AreEqual(expected, consoleText); + var toVersionedFile = new RingtoetsVersionedFile(targetFilePath); + Assert.AreEqual(expectedVersion, toVersionedFile.GetVersion()); } - - // 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()); } Assert.AreEqual(ErrorCode.ErrorSuccess, environmentControl.ErrorCodeCalled); } @@ -153,10 +150,9 @@ public void GivenConsole_WhenMigrateCalledUnableToSaveTarget_ThenExitWithErrorCode() { // Given - string sourceFilePath = TestHelper.GetTestDataPath(TestDataPath.Application.Ringtoets.Migration, "FullTestProject164.rtd"); - string targetFilePath = TestHelper.GetTestDataPath(TestDataPath.Application.Ringtoets.Migration, Path.GetRandomFileName()); + string sourceFilePath = TestHelper.GetTestDataPath(testPath, "FullTestProject164.rtd"); + string targetFilePath = TestHelper.GetTestDataPath(testPath, Path.GetRandomFileName()); - string consoleText; using (var fileDisposeHelper = new FileDisposeHelper(targetFilePath)) using (var consoleOutput = new ConsoleOutput()) { @@ -169,17 +165,18 @@ targetFilePath }); - consoleText = consoleOutput.GetConsoleOutput(); + // Then + string consoleText = consoleOutput.GetConsoleOutput(); + StringAssert.StartsWith(Environment.NewLine + + "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); } - // 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); } Index: Migration/Console/src/Migration.Console/ConsoleBase.cs =================================================================== diff -u -rc2d1014f9ad458166d0ccad5800da9f674a8152a -r369c682fee14bf5c99b2a11f8d61f8a529bae459 --- Migration/Console/src/Migration.Console/ConsoleBase.cs (.../ConsoleBase.cs) (revision c2d1014f9ad458166d0ccad5800da9f674a8152a) +++ Migration/Console/src/Migration.Console/ConsoleBase.cs (.../ConsoleBase.cs) (revision 369c682fee14bf5c99b2a11f8d61f8a529bae459) @@ -64,6 +64,7 @@ /// By default, the help command is executed. public void ExecuteConsoleTool(string[] args) { + SystemConsole.WriteLine(); try { ParseCommand(args); Index: Migration/Console/test/Migration.Console.Test/ConsoleBaseTest.cs =================================================================== diff -u -rc2d1014f9ad458166d0ccad5800da9f674a8152a -r369c682fee14bf5c99b2a11f8d61f8a529bae459 --- Migration/Console/test/Migration.Console.Test/ConsoleBaseTest.cs (.../ConsoleBaseTest.cs) (revision c2d1014f9ad458166d0ccad5800da9f674a8152a) +++ Migration/Console/test/Migration.Console.Test/ConsoleBaseTest.cs (.../ConsoleBaseTest.cs) (revision 369c682fee14bf5c99b2a11f8d61f8a529bae459) @@ -93,7 +93,8 @@ // Assert string consoleText = consoleOutput.GetConsoleOutput(); - Assert.AreEqual(GetConsoleFullDescription(), consoleText); + string expectedText = Environment.NewLine + GetConsoleFullDescription(); + Assert.AreEqual(expectedText, consoleText); Assert.AreEqual(ErrorCode.ErrorSuccess, environmentControl.ErrorCodeCalled); } } @@ -116,7 +117,8 @@ // Assert string consoleText = consoleOutput.GetConsoleOutput(); - Assert.AreEqual(GetConsoleFullDescription(), consoleText); + string expectedText = Environment.NewLine + GetConsoleFullDescription(); + Assert.AreEqual(expectedText, consoleText); Assert.AreEqual(ErrorCode.ErrorSuccess, environmentControl.ErrorCodeCalled); } } @@ -138,7 +140,7 @@ consoleBase.SimpleExecuteConsoleTool(commandArgs); // Assert - Assert.IsEmpty(consoleOutput.GetConsoleOutput()); + Assert.AreEqual(Environment.NewLine, consoleOutput.GetConsoleOutput()); Assert.AreEqual(commandArgs, consoleBase.ExecuteCommandArguments); Assert.AreEqual(ErrorCode.ErrorSuccess, environmentControl.ErrorCodeCalled); } @@ -164,7 +166,7 @@ consoleBase.SimpleExecuteConsoleTool(commandArgs); // Assert - string expectedtext = exceptionMessage + Environment.NewLine + string expectedtext = Environment.NewLine + exceptionMessage + Environment.NewLine + Environment.NewLine + GetConsoleFullDescription(); string consoleText = consoleOutput.GetConsoleOutput(); Assert.AreEqual(expectedtext, consoleText); @@ -196,7 +198,7 @@ consoleBase.SimpleExecuteConsoleTool(commandArgs); // Assert - string expectedtext = exceptionMessage + Environment.NewLine + string expectedtext = Environment.NewLine + exceptionMessage + Environment.NewLine + $"Het besturingssysteem geeft de volgende melding: {innerExceptionMessage}" + Environment.NewLine + Environment.NewLine + GetConsoleFullDescription();