Index: Application/Ringtoets/src/Application.Ringtoets.Migration/Properties/Resources.Designer.cs =================================================================== diff -u -r6c23a40fd7d5f9ab4f4113d49bc7635e895b0a34 -r7b85dbce8bcc39e824c367468892764778527ce4 --- Application/Ringtoets/src/Application.Ringtoets.Migration/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 6c23a40fd7d5f9ab4f4113d49bc7635e895b0a34) +++ Application/Ringtoets/src/Application.Ringtoets.Migration/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 7b85dbce8bcc39e824c367468892764778527ce4) @@ -82,9 +82,18 @@ } /// + /// Looks up a localized string similar to Bronprojectpad moet een geldig bestandspad zijn.. + /// + public static string CommandSupported_Source_Not_Valid_Path { + get { + return ResourceManager.GetString("CommandSupported_Source_Not_Valid_Path", resourceCulture); + } + } + + /// /// Looks up a localized string similar to /* ---------------------------------------------------- */ ////* Generated by Enterprise Architect Version 12.0 */ - ////* Created On : 06-Feb-2017 08:19:11 */ + ////* Created On : 15-feb-2017 11:11:55 */ ////* DBMS : SQLite */ ////* ---------------------------------------------------- */ /// Index: Application/Ringtoets/src/Application.Ringtoets.Migration/Properties/Resources.resx =================================================================== diff -u -r6c23a40fd7d5f9ab4f4113d49bc7635e895b0a34 -r7b85dbce8bcc39e824c367468892764778527ce4 --- Application/Ringtoets/src/Application.Ringtoets.Migration/Properties/Resources.resx (.../Resources.resx) (revision 6c23a40fd7d5f9ab4f4113d49bc7635e895b0a34) +++ Application/Ringtoets/src/Application.Ringtoets.Migration/Properties/Resources.resx (.../Resources.resx) (revision 7b85dbce8bcc39e824c367468892764778527ce4) @@ -133,4 +133,7 @@ Het migreren van het Ringtoets projectbestand van versie '{0}' naar '{1}' is mislukt. + + Bronprojectpad moet een geldig bestandspad zijn. + \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.MigrationConsole/Application.Ringtoets.MigrationConsole.csproj =================================================================== diff -u -r896b05735de6229ba6108507c79d8207fa3f2d26 -r7b85dbce8bcc39e824c367468892764778527ce4 --- Application/Ringtoets/src/Application.Ringtoets.MigrationConsole/Application.Ringtoets.MigrationConsole.csproj (.../Application.Ringtoets.MigrationConsole.csproj) (revision 896b05735de6229ba6108507c79d8207fa3f2d26) +++ Application/Ringtoets/src/Application.Ringtoets.MigrationConsole/Application.Ringtoets.MigrationConsole.csproj (.../Application.Ringtoets.MigrationConsole.csproj) (revision 7b85dbce8bcc39e824c367468892764778527ce4) @@ -54,6 +54,11 @@ + + {F49BD8B2-332A-4C91-A196-8CCE0A2C7D98} + Core.Common.Utils + False + {2E2C9B96-E72A-4C10-AA54-A5381FE30B0D} Migration.Console Index: Application/Ringtoets/src/Application.Ringtoets.MigrationConsole/Properties/Resources.Designer.cs =================================================================== diff -u -r808d8de82712c31f26cf21ea82f849d7bb728caa -r7b85dbce8bcc39e824c367468892764778527ce4 --- Application/Ringtoets/src/Application.Ringtoets.MigrationConsole/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 808d8de82712c31f26cf21ea82f849d7bb728caa) +++ Application/Ringtoets/src/Application.Ringtoets.MigrationConsole/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 7b85dbce8bcc39e824c367468892764778527ce4) @@ -109,11 +109,11 @@ } /// - /// Looks up a localized string similar to Bron- en doelprojectpad mogen niet leeg of ongedefinieerd zijn.. + /// Looks up a localized string similar to Bron- en doelprojectpad moeten geldige bestandspaden zijn.. /// - internal static string CommandMigrate_Source_Or_Destination_Null_Or_Empty { + internal static string CommandMigrate_Source_Or_Destination_Not_Valid_Path { get { - return ResourceManager.GetString("CommandMigrate_Source_Or_Destination_Null_Or_Empty", resourceCulture); + return ResourceManager.GetString("CommandMigrate_Source_Or_Destination_Not_Valid_Path", resourceCulture); } } Index: Application/Ringtoets/src/Application.Ringtoets.MigrationConsole/Properties/Resources.resx =================================================================== diff -u -r808d8de82712c31f26cf21ea82f849d7bb728caa -r7b85dbce8bcc39e824c367468892764778527ce4 --- Application/Ringtoets/src/Application.Ringtoets.MigrationConsole/Properties/Resources.resx (.../Resources.resx) (revision 808d8de82712c31f26cf21ea82f849d7bb728caa) +++ Application/Ringtoets/src/Application.Ringtoets.MigrationConsole/Properties/Resources.resx (.../Resources.resx) (revision 7b85dbce8bcc39e824c367468892764778527ce4) @@ -144,7 +144,7 @@ MIGRATIEHULPPROGRAMMA - - Bron- en doelprojectpad mogen niet leeg of ongedefinieerd zijn. + + Bron- en doelprojectpad moeten geldige bestandspaden zijn. \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.MigrationConsole/RingtoetsMigrationConsole.cs =================================================================== diff -u -r808d8de82712c31f26cf21ea82f849d7bb728caa -r7b85dbce8bcc39e824c367468892764778527ce4 --- Application/Ringtoets/src/Application.Ringtoets.MigrationConsole/RingtoetsMigrationConsole.cs (.../RingtoetsMigrationConsole.cs) (revision 808d8de82712c31f26cf21ea82f849d7bb728caa) +++ Application/Ringtoets/src/Application.Ringtoets.MigrationConsole/RingtoetsMigrationConsole.cs (.../RingtoetsMigrationConsole.cs) (revision 7b85dbce8bcc39e824c367468892764778527ce4) @@ -22,6 +22,7 @@ using System; using Application.Ringtoets.Migration; using Application.Ringtoets.MigrationConsole.Properties; +using Core.Common.Utils; using Migration.Console; using Ringtoets.Common.Utils; using MigrationCoreStorageResources = Migration.Core.Storage.Properties.Resources; @@ -78,8 +79,10 @@ private static void IsVersionSupportedCommand(string location) { + ValidateIsVersionSupportedArgument(location); + + RingtoetsVersionedFile versionedFile = new RingtoetsVersionedFile(location); var migrator = new RingtoetsSqLiteDatabaseFileMigrator(); - var versionedFile = new RingtoetsVersionedFile(location); var version = versionedFile.GetVersion(); bool isSupported = migrator.IsVersionSupported(version); @@ -95,6 +98,14 @@ } } + private static void ValidateIsVersionSupportedArgument(string location) + { + if (!IOUtils.IsValidFilePath(location)) + { + throw new ArgumentException(Migration.Properties.Resources.CommandSupported_Source_Not_Valid_Path); + } + } + private static void ShowSupportedCommand() { Console.WriteLine(Resources.CommandSupported_Brief); @@ -103,10 +114,7 @@ private static void MigrateCommand(string filepath, string toFilepath) { - if (string.IsNullOrEmpty(filepath) || string.IsNullOrEmpty(toFilepath)) - { - throw new ArgumentException(Resources.CommandMigrate_Source_Or_Destination_Null_Or_Empty); - } + ValidateMigrationArguments(filepath, toFilepath); var migrator = new RingtoetsSqLiteDatabaseFileMigrator(); var sourceFile = new RingtoetsVersionedFile(filepath); @@ -115,6 +123,14 @@ filepath, toFilepath, currentDatabaseVersion); } + private static void ValidateMigrationArguments(string filepath, string toFilepath) + { + if (!(IOUtils.IsValidFilePath(filepath) && IOUtils.IsValidFilePath(toFilepath))) + { + throw new ArgumentException(Resources.CommandMigrate_Source_Or_Destination_Not_Valid_Path); + } + } + private static void ShowMigrateCommand() { Console.WriteLine(Resources.CommandMigrate_Brief); Index: Application/Ringtoets/test/Application.Ringtoets.MigrationConsole.Test/RingtoetsMigrationConsoleTest.cs =================================================================== diff -u -r808d8de82712c31f26cf21ea82f849d7bb728caa -r7b85dbce8bcc39e824c367468892764778527ce4 --- Application/Ringtoets/test/Application.Ringtoets.MigrationConsole.Test/RingtoetsMigrationConsoleTest.cs (.../RingtoetsMigrationConsoleTest.cs) (revision 808d8de82712c31f26cf21ea82f849d7bb728caa) +++ Application/Ringtoets/test/Application.Ringtoets.MigrationConsole.Test/RingtoetsMigrationConsoleTest.cs (.../RingtoetsMigrationConsoleTest.cs) (revision 7b85dbce8bcc39e824c367468892764778527ce4) @@ -118,7 +118,7 @@ // Assert string expectedText = Environment.NewLine - + "Bron- en doelprojectpad mogen niet leeg of ongedefinieerd zijn." + + "Bron- en doelprojectpad moeten geldige bestandspaden zijn." + Environment.NewLine + Environment.NewLine + GetConsoleFullDescription(); string consoleText = consoleOutput.GetConsoleOutput(); Index: Core/Common/src/Core.Common.Utils/IOUtils.cs =================================================================== diff -u -r808d8de82712c31f26cf21ea82f849d7bb728caa -r7b85dbce8bcc39e824c367468892764778527ce4 --- Core/Common/src/Core.Common.Utils/IOUtils.cs (.../IOUtils.cs) (revision 808d8de82712c31f26cf21ea82f849d7bb728caa) +++ Core/Common/src/Core.Common.Utils/IOUtils.cs (.../IOUtils.cs) (revision 7b85dbce8bcc39e824c367468892764778527ce4) @@ -72,34 +72,16 @@ /// public static void ValidateFolderPath(string path) { - if (string.IsNullOrWhiteSpace(path)) - { - var message = new DirectoryWriterErrorMessageBuilder(path) - .Build(Resources.IOUtils_ValidateFolderPath_Path_cannot_be_empty); - throw new ArgumentException(message); - } try { - string fullPath = Path.GetFullPath(path); + string fullPath = GetFullPath(path); } - catch (SecurityException e) + catch (ArgumentException exception) { var message = new DirectoryWriterErrorMessageBuilder(path) - .Build(Resources.IOUtils_ValidateFolderPath_No_access_rights_to_folder); - throw new ArgumentException(message, e); + .Build(exception.Message); + throw new ArgumentException(message, exception.InnerException); } - catch (PathTooLongException e) - { - var message = new DirectoryWriterErrorMessageBuilder(path) - .Build(Resources.IOUtils_ValidateFolderPath_Folder_path_too_long); - throw new ArgumentException(message, e); - } - catch (NotSupportedException e) - { - var message = new DirectoryWriterErrorMessageBuilder(path) - .Build(Resources.IOUtils_ValidateFolderPath_Folder_path_contains_invalid_character); - throw new ArgumentException(message, e); - } } /// @@ -128,13 +110,11 @@ { name = Path.GetFileName(path); } - catch (ArgumentException e) + catch (ArgumentException exception) { var message = new FileReaderErrorMessageBuilder(path) - .Build(string.Format(CultureInfo.CurrentCulture, - Resources.Error_Path_cannot_contain_Characters_0_, - string.Join(", ", Path.GetInvalidPathChars()))); - throw new ArgumentException(message, e); + .Build(Resources.Error_Path_cannot_contain_invalid_characters); + throw new ArgumentException(message, exception); } if (string.IsNullOrEmpty(name)) { @@ -241,5 +221,49 @@ } } } + + /// + /// Returns the absolute path for the specified path string. + /// + /// The file or directory for which to obtain absolute path information. + /// The fully qualified location of path, such as "C:\MyFile.txt". + /// Thrown when: + /// + /// The path is null, empty or contains only whitespaces. + /// The caller has no access rights to the path. + /// The path is too long. + /// The path contains a ':' that is not part of a volume identifier. + /// + public static string GetFullPath(string path) + { + if (string.IsNullOrWhiteSpace(path)) + { + throw new ArgumentException(Resources.IOUtils_Path_cannot_be_empty); + } + try + { + return Path.GetFullPath(path); + } + catch (ArgumentException exception) + { + throw new ArgumentException(Resources.Error_Path_cannot_contain_invalid_characters, + exception); + } + catch (SecurityException exception) + { + throw new ArgumentException(Resources.IOUtils_No_access_rights_to_path, + exception); + } + catch (PathTooLongException exception) + { + throw new ArgumentException(Resources.IOUtils_Path_too_long, + exception); + } + catch (NotSupportedException exception) + { + throw new ArgumentException(Resources.IOUtils_Path_contains_invalid_character, + exception); + } + } } } \ No newline at end of file Index: Core/Common/src/Core.Common.Utils/Properties/Resources.Designer.cs =================================================================== diff -u -r6c1eddbd3f88a9dcedec6c113de50416073ddfb3 -r7b85dbce8bcc39e824c367468892764778527ce4 --- Core/Common/src/Core.Common.Utils/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 6c1eddbd3f88a9dcedec6c113de50416073ddfb3) +++ Core/Common/src/Core.Common.Utils/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 7b85dbce8bcc39e824c367468892764778527ce4) @@ -163,11 +163,11 @@ } /// - /// Looks up a localized string similar to Bestandspad mag niet de volgende tekens bevatten: {0}. + /// Looks up a localized string similar to Er zitten ongeldige tekens in het bestandspad. Alle tekens in het bestandspad moeten geldig zijn.. /// - public static string Error_Path_cannot_contain_Characters_0_ { + public static string Error_Path_cannot_contain_invalid_characters { get { - return ResourceManager.GetString("Error_Path_cannot_contain_Characters_0_", resourceCulture); + return ResourceManager.GetString("Error_Path_cannot_contain_invalid_characters", resourceCulture); } } @@ -227,38 +227,38 @@ } /// - /// Looks up a localized string similar to Het pad naar bestandsmap bevat een ':' op een ongeldige plek.. + /// Looks up a localized string similar to Geen toegangsrechten tot bestandspad.. /// - public static string IOUtils_ValidateFolderPath_Folder_path_contains_invalid_character { + public static string IOUtils_No_access_rights_to_path { get { - return ResourceManager.GetString("IOUtils_ValidateFolderPath_Folder_path_contains_invalid_character", resourceCulture); + return ResourceManager.GetString("IOUtils_No_access_rights_to_path", resourceCulture); } } /// - /// Looks up a localized string similar to Het pad naar bestandsmap is te lang.. + /// Looks up a localized string similar to Het bestandspad moet opgegeven zijn.. /// - public static string IOUtils_ValidateFolderPath_Folder_path_too_long { + public static string IOUtils_Path_cannot_be_empty { get { - return ResourceManager.GetString("IOUtils_ValidateFolderPath_Folder_path_too_long", resourceCulture); + return ResourceManager.GetString("IOUtils_Path_cannot_be_empty", resourceCulture); } } /// - /// Looks up a localized string similar to Geen toegangsrechten tot bestandsmap.. + /// Looks up a localized string similar to Het bestandspad bevat een ':' op een ongeldige plek.. /// - public static string IOUtils_ValidateFolderPath_No_access_rights_to_folder { + public static string IOUtils_Path_contains_invalid_character { get { - return ResourceManager.GetString("IOUtils_ValidateFolderPath_No_access_rights_to_folder", resourceCulture); + return ResourceManager.GetString("IOUtils_Path_contains_invalid_character", resourceCulture); } } /// - /// Looks up a localized string similar to Pad naar bestandsmap moet opgegeven zijn.. + /// Looks up a localized string similar to Het bestandspad is te lang.. /// - public static string IOUtils_ValidateFolderPath_Path_cannot_be_empty { + public static string IOUtils_Path_too_long { get { - return ResourceManager.GetString("IOUtils_ValidateFolderPath_Path_cannot_be_empty", resourceCulture); + return ResourceManager.GetString("IOUtils_Path_too_long", resourceCulture); } } Index: Core/Common/src/Core.Common.Utils/Properties/Resources.resx =================================================================== diff -u -r6c1eddbd3f88a9dcedec6c113de50416073ddfb3 -r7b85dbce8bcc39e824c367468892764778527ce4 --- Core/Common/src/Core.Common.Utils/Properties/Resources.resx (.../Resources.resx) (revision 6c1eddbd3f88a9dcedec6c113de50416073ddfb3) +++ Core/Common/src/Core.Common.Utils/Properties/Resources.resx (.../Resources.resx) (revision 7b85dbce8bcc39e824c367468892764778527ce4) @@ -129,8 +129,8 @@ Er is een onverwachte fout opgetreden tijdens het inlezen van het bestand '{0}'. - - Bestandspad mag niet de volgende tekens bevatten: {0} + + Er zitten ongeldige tekens in het bestandspad. Alle tekens in het bestandspad moeten geldig zijn. Bestandspad mag niet leeg of ongedefinieerd zijn. @@ -168,17 +168,17 @@ Fout bij het schrijven naar bestandsmap '{0}': {1} - - Pad naar bestandsmap moet opgegeven zijn. + + Het bestandspad moet opgegeven zijn. - - Geen toegangsrechten tot bestandsmap. + + Geen toegangsrechten tot bestandspad. - - Het pad naar bestandsmap is te lang. + + Het bestandspad is te lang. - - Het pad naar bestandsmap bevat een ':' op een ongeldige plek. + + Het bestandspad bevat een ':' op een ongeldige plek. Toegankelijk gebied moet geheel binnen de afbeelding vallen. Index: Core/Common/test/Core.Common.IO.Test/Readers/SqLiteDatabaseReaderBaseTest.cs =================================================================== diff -u -r808d8de82712c31f26cf21ea82f849d7bb728caa -r7b85dbce8bcc39e824c367468892764778527ce4 --- Core/Common/test/Core.Common.IO.Test/Readers/SqLiteDatabaseReaderBaseTest.cs (.../SqLiteDatabaseReaderBaseTest.cs) (revision 808d8de82712c31f26cf21ea82f849d7bb728caa) +++ Core/Common/test/Core.Common.IO.Test/Readers/SqLiteDatabaseReaderBaseTest.cs (.../SqLiteDatabaseReaderBaseTest.cs) (revision 7b85dbce8bcc39e824c367468892764778527ce4) @@ -86,8 +86,7 @@ // Assert var expectedMessage = new FileReaderErrorMessageBuilder(corruptPath) - .Build(string.Format(UtilsResources.Error_Path_cannot_contain_Characters_0_, - string.Join(", ", Path.GetInvalidPathChars()))); + .Build("Er zitten ongeldige tekens in het bestandspad. Alle tekens in het bestandspad moeten geldig zijn."); var exception = Assert.Throws(test); Assert.AreEqual(expectedMessage, exception.Message); } Index: Core/Common/test/Core.Common.Utils.Test/IOUtilsTest.cs =================================================================== diff -u -r39bbb7b4108d845bf7834c1b92a983e35109271f -r7b85dbce8bcc39e824c367468892764778527ce4 --- Core/Common/test/Core.Common.Utils.Test/IOUtilsTest.cs (.../IOUtilsTest.cs) (revision 39bbb7b4108d845bf7834c1b92a983e35109271f) +++ Core/Common/test/Core.Common.Utils.Test/IOUtilsTest.cs (.../IOUtilsTest.cs) (revision 7b85dbce8bcc39e824c367468892764778527ce4) @@ -35,6 +35,99 @@ [TestCase(null)] [TestCase("")] [TestCase(" ")] + public void GetFullPath_InvalidEmptyPath_ThrowsArgumentException(string invalidPath) + { + // Call + TestDelegate call = () => IOUtils.GetFullPath(invalidPath); + + // Assert + var message = "Het bestandspad moet opgegeven zijn."; + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, message); + } + + [Test] + public void GetFullPath_PathTooLong_ThrowsArgumentException() + { + // Setup + var stringBuilder = new StringBuilder(); + stringBuilder.Append(@"C:\"); + for (var i = 0; i < 300; i++) + { + stringBuilder.Append("A"); + } + stringBuilder.Append(Path.DirectorySeparatorChar); + string tooLongFolderPath = stringBuilder.ToString(); + + // Call + TestDelegate call = () => IOUtils.GetFullPath(tooLongFolderPath); + + // Assert + string message = "Het bestandspad is te lang."; + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, message); + } + + [Test] + public void GetFullPath_PathContainingInvalidPathCharacters_ThrowsArgumentException() + { + // Setup + string path = TestHelper.GetTestDataPath(TestDataPath.Core.Common.Utils, "validFile.txt"); + char[] invalidPathChars = Path.GetInvalidPathChars(); + string invalidPath = path.Replace('d', invalidPathChars[0]); + + // Call + TestDelegate call = () => IOUtils.GetFullPath(invalidPath); + + // Assert + var message = "Er zitten ongeldige tekens in het bestandspad. Alle tekens in het bestandspad moeten geldig zijn."; + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, message); + } + + [Test] + public void GetFullPath_InvalidColonCharacterInPath_ThrowsArgumentException() + { + // Setup + var folderWithInvalidColonCharacter = @"C:\Left:Right"; + + // Call + TestDelegate call = () => IOUtils.GetFullPath(folderWithInvalidColonCharacter); + + // Assert + var message = "Het bestandspad bevat een ':' op een ongeldige plek."; + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, message); + } + + [Test] + public void GetFullPath_ValidPath_ReturnsFullPath() + { + // Setup + string path = TestHelper.GetTestDataPath(TestDataPath.Core.Common.Utils); + + // Call + string actualFilePath = IOUtils.GetFullPath(path); + + // Assert + string expectedFilePath = Path.GetFullPath(path); + Assert.AreEqual(expectedFilePath, actualFilePath); + } + + [Test] + public void GetFullPath_ValidFilePath_ReturnsFullPath() + { + // Setup + string path = TestHelper.GetTestDataPath(TestDataPath.Core.Common.Utils, "validFile.txt"); + + // Call + string actualFilePath = IOUtils.GetFullPath(path); + + // Assert + string expectedFilePath = Path.GetFullPath(path); + Assert.AreEqual(expectedFilePath, actualFilePath); + } + + [Test] + [TestCase(null)] + [TestCase("")] + [TestCase(" ")] public void IsValidFolderPath_InvalidEmptyPath_ReturnFalse(string invalidPath) { // Call @@ -100,7 +193,7 @@ TestDelegate call = () => IOUtils.ValidateFolderPath(invalidPath); // Assert - string message = $"Fout bij het schrijven naar bestandsmap '{invalidPath}': pad naar bestandsmap moet opgegeven zijn."; + string message = $"Fout bij het schrijven naar bestandsmap '{invalidPath}': het bestandspad moet opgegeven zijn."; TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, message); } @@ -121,7 +214,7 @@ TestDelegate call = () => IOUtils.ValidateFolderPath(tooLongFolderPath); // Assert - string message = $"Fout bij het schrijven naar bestandsmap '{tooLongFolderPath}': het pad naar bestandsmap is te lang."; + string message = $"Fout bij het schrijven naar bestandsmap '{tooLongFolderPath}': het bestandspad is te lang."; TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, message); } @@ -135,7 +228,7 @@ TestDelegate call = () => IOUtils.ValidateFolderPath(folderWithInvalidColonCharacter); // Assert - string message = $"Fout bij het schrijven naar bestandsmap '{folderWithInvalidColonCharacter}': het pad naar bestandsmap bevat een ':' op een ongeldige plek."; + string message = $"Fout bij het schrijven naar bestandsmap '{folderWithInvalidColonCharacter}': het bestandspad bevat een ':' op een ongeldige plek."; TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, message); } @@ -153,7 +246,7 @@ } [Test] - public void ValidateFilePath_ValidPath_DoesNotThrowAnyExceptions() + public void ValidateFilePath_ValidFilePath_DoesNotThrowExceptions() { // Setup string path = TestHelper.GetTestDataPath(TestDataPath.Core.Common.Utils, "validFile.txt"); @@ -193,8 +286,8 @@ // Assert var exception = Assert.Throws(call); - string invalidChars = string.Join(", ", invalidPathChars); - var expectedMessage = $"Fout bij het lezen van bestand '{invalidPath}': bestandspad mag niet de volgende tekens bevatten: {invalidChars}"; + var expectedMessage = $"Fout bij het lezen van bestand '{invalidPath}': er zitten ongeldige tekens in het bestandspad. " + + "Alle tekens in het bestandspad moeten geldig zijn."; Assert.AreEqual(expectedMessage, exception.Message); } Index: Core/Components/test/Core.Components.DotSpatial.Forms.Test/IO/WmtsConnectionInfoReaderTest.cs =================================================================== diff -u -r39bbb7b4108d845bf7834c1b92a983e35109271f -r7b85dbce8bcc39e824c367468892764778527ce4 --- Core/Components/test/Core.Components.DotSpatial.Forms.Test/IO/WmtsConnectionInfoReaderTest.cs (.../WmtsConnectionInfoReaderTest.cs) (revision 39bbb7b4108d845bf7834c1b92a983e35109271f) +++ Core/Components/test/Core.Components.DotSpatial.Forms.Test/IO/WmtsConnectionInfoReaderTest.cs (.../WmtsConnectionInfoReaderTest.cs) (revision 7b85dbce8bcc39e824c367468892764778527ce4) @@ -80,8 +80,8 @@ TestDelegate call = () => reader.ReadWmtsConnectionInfos(filePath); // Assert - string invalidChars = string.Join(", ", invalidPathChars); - var expectedMessage = $"Fout bij het lezen van bestand 'c:/\".config': bestandspad mag niet de volgende tekens bevatten: {invalidChars}"; + var expectedMessage = "Fout bij het lezen van bestand 'c:/\".config': " + + "er zitten ongeldige tekens in het bestandspad. Alle tekens in het bestandspad moeten geldig zijn."; TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage); } Index: Core/Components/test/Core.Components.DotSpatial.Forms.Test/IO/WmtsConnectionInfoWriterTest.cs =================================================================== diff -u -r39bbb7b4108d845bf7834c1b92a983e35109271f -r7b85dbce8bcc39e824c367468892764778527ce4 --- Core/Components/test/Core.Components.DotSpatial.Forms.Test/IO/WmtsConnectionInfoWriterTest.cs (.../WmtsConnectionInfoWriterTest.cs) (revision 39bbb7b4108d845bf7834c1b92a983e35109271f) +++ Core/Components/test/Core.Components.DotSpatial.Forms.Test/IO/WmtsConnectionInfoWriterTest.cs (.../WmtsConnectionInfoWriterTest.cs) (revision 7b85dbce8bcc39e824c367468892764778527ce4) @@ -73,8 +73,8 @@ TestDelegate call = () => new WmtsConnectionInfoWriter(filePath); // Assert - string invalidChars = string.Join(", ", invalidPathChars); - var expectedMessage = $"Fout bij het lezen van bestand '{filePath}': bestandspad mag niet de volgende tekens bevatten: {invalidChars}"; + var expectedMessage = $"Fout bij het lezen van bestand '{filePath}': " + + "er zitten ongeldige tekens in het bestandspad. Alle tekens in het bestandspad moeten geldig zijn."; TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage); } Index: Core/Components/test/Core.Components.Gis.IO.Test/Readers/ShapeFileReaderBaseTest.cs =================================================================== diff -u -r808d8de82712c31f26cf21ea82f849d7bb728caa -r7b85dbce8bcc39e824c367468892764778527ce4 --- Core/Components/test/Core.Components.Gis.IO.Test/Readers/ShapeFileReaderBaseTest.cs (.../ShapeFileReaderBaseTest.cs) (revision 808d8de82712c31f26cf21ea82f849d7bb728caa) +++ Core/Components/test/Core.Components.Gis.IO.Test/Readers/ShapeFileReaderBaseTest.cs (.../ShapeFileReaderBaseTest.cs) (revision 7b85dbce8bcc39e824c367468892764778527ce4) @@ -97,8 +97,8 @@ TestDelegate call = () => new TestShapeFileReaderBase(invalidFilePath); // Assert - var expectedMessage = string.Format("Fout bij het lezen van bestand '{0}': bestandspad mag niet de volgende tekens bevatten: {1}", - invalidFilePath, string.Join(", ", invalidPathChars)); + var expectedMessage = $"Fout bij het lezen van bestand '{invalidFilePath}': " + + "er zitten ongeldige tekens in het bestandspad. Alle tekens in het bestandspad moeten geldig zijn."; TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage); } Index: Core/Components/test/Core.Components.Gis.IO.Test/Writers/ShapeFileWriterBaseTest.cs =================================================================== diff -u -r39bbb7b4108d845bf7834c1b92a983e35109271f -r7b85dbce8bcc39e824c367468892764778527ce4 --- Core/Components/test/Core.Components.Gis.IO.Test/Writers/ShapeFileWriterBaseTest.cs (.../ShapeFileWriterBaseTest.cs) (revision 39bbb7b4108d845bf7834c1b92a983e35109271f) +++ Core/Components/test/Core.Components.Gis.IO.Test/Writers/ShapeFileWriterBaseTest.cs (.../ShapeFileWriterBaseTest.cs) (revision 7b85dbce8bcc39e824c367468892764778527ce4) @@ -125,8 +125,8 @@ TestDelegate call = () => writer.SaveAs(filePath); // Assert - string invalidChars = string.Join(", ", invalidPathChars); - var expectedMessage = $"Fout bij het lezen van bestand 'c:/\".shp': bestandspad mag niet de volgende tekens bevatten: {invalidChars}"; + var expectedMessage = "Fout bij het lezen van bestand 'c:/\".shp': " + + "er zitten ongeldige tekens in het bestandspad. Alle tekens in het bestandspad moeten geldig zijn."; TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage); } } Index: Migration/Core/src/Migration.Core.Storage/Migration.Core.Storage.csproj =================================================================== diff -u -r6aec8d56eca1d311fe0696a3d5fa0389517f2ee9 -r7b85dbce8bcc39e824c367468892764778527ce4 --- Migration/Core/src/Migration.Core.Storage/Migration.Core.Storage.csproj (.../Migration.Core.Storage.csproj) (revision 6aec8d56eca1d311fe0696a3d5fa0389517f2ee9) +++ Migration/Core/src/Migration.Core.Storage/Migration.Core.Storage.csproj (.../Migration.Core.Storage.csproj) (revision 7b85dbce8bcc39e824c367468892764778527ce4) @@ -65,6 +65,11 @@ + + {F49BD8B2-332A-4C91-A196-8CCE0A2C7D98} + Core.Common.Utils + False + {6A074D65-A81C-4C1C-8E24-F36C916E4ED7} Ringtoets.Common.Utils Index: Migration/Core/src/Migration.Core.Storage/VersionedFileMigrator.cs =================================================================== diff -u -r6aec8d56eca1d311fe0696a3d5fa0389517f2ee9 -r7b85dbce8bcc39e824c367468892764778527ce4 --- Migration/Core/src/Migration.Core.Storage/VersionedFileMigrator.cs (.../VersionedFileMigrator.cs) (revision 6aec8d56eca1d311fe0696a3d5fa0389517f2ee9) +++ Migration/Core/src/Migration.Core.Storage/VersionedFileMigrator.cs (.../VersionedFileMigrator.cs) (revision 7b85dbce8bcc39e824c367468892764778527ce4) @@ -24,6 +24,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; +using Core.Common.Utils; using Migration.Core.Storage.Properties; using Migration.Scripts.Data; using Migration.Scripts.Data.Exceptions; @@ -131,7 +132,7 @@ { throw new ArgumentNullException(nameof(newFileLocation)); } - if (Path.GetFullPath(versionedFile.Location).Equals(Path.GetFullPath(newFileLocation))) + if (IOUtils.GetFullPath(versionedFile.Location).Equals(IOUtils.GetFullPath(newFileLocation))) { throw new CriticalMigrationException(Resources.Migrate_Target_File_Path_Must_Differ_From_Source_File_Path); } Index: Ringtoets/Common/src/Ringtoets.Common.IO/ReferenceLines/ReferenceLineMetaImporter.cs =================================================================== diff -u -r39bbb7b4108d845bf7834c1b92a983e35109271f -r7b85dbce8bcc39e824c367468892764778527ce4 --- Ringtoets/Common/src/Ringtoets.Common.IO/ReferenceLines/ReferenceLineMetaImporter.cs (.../ReferenceLineMetaImporter.cs) (revision 39bbb7b4108d845bf7834c1b92a983e35109271f) +++ Ringtoets/Common/src/Ringtoets.Common.IO/ReferenceLines/ReferenceLineMetaImporter.cs (.../ReferenceLineMetaImporter.cs) (revision 7b85dbce8bcc39e824c367468892764778527ce4) @@ -112,8 +112,7 @@ catch (ArgumentException e) { var message = new FileReaderErrorMessageBuilder(path) - .Build(string.Format(Resources.Error_Path_cannot_contain_Characters_0_, - string.Join(", ", Path.GetInvalidPathChars()))); + .Build(Resources.Error_Path_cannot_contain_invalid_characters); throw new ArgumentException(message, e); } catch (Exception e) Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/DikeProfiles/DikeProfileDataReaderTest.cs =================================================================== diff -u -r808d8de82712c31f26cf21ea82f849d7bb728caa -r7b85dbce8bcc39e824c367468892764778527ce4 --- Ringtoets/Common/test/Ringtoets.Common.IO.Test/DikeProfiles/DikeProfileDataReaderTest.cs (.../DikeProfileDataReaderTest.cs) (revision 808d8de82712c31f26cf21ea82f849d7bb728caa) +++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/DikeProfiles/DikeProfileDataReaderTest.cs (.../DikeProfileDataReaderTest.cs) (revision 7b85dbce8bcc39e824c367468892764778527ce4) @@ -91,8 +91,8 @@ TestDelegate call = () => reader.ReadDikeProfileData(invalidFilePath); // Assert - var expectedMessage = string.Format("Fout bij het lezen van bestand '{0}': bestandspad mag niet de volgende tekens bevatten: {1}", - invalidFilePath, string.Join(", ", invalidPathChars)); + var expectedMessage = $"Fout bij het lezen van bestand '{invalidFilePath}': " + + "er zitten ongeldige tekens in het bestandspad. Alle tekens in het bestandspad moeten geldig zijn."; TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage); } Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/DikeProfiles/ProfileLocationReaderTest.cs =================================================================== diff -u -r808d8de82712c31f26cf21ea82f849d7bb728caa -r7b85dbce8bcc39e824c367468892764778527ce4 --- Ringtoets/Common/test/Ringtoets.Common.IO.Test/DikeProfiles/ProfileLocationReaderTest.cs (.../ProfileLocationReaderTest.cs) (revision 808d8de82712c31f26cf21ea82f849d7bb728caa) +++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/DikeProfiles/ProfileLocationReaderTest.cs (.../ProfileLocationReaderTest.cs) (revision 7b85dbce8bcc39e824c367468892764778527ce4) @@ -77,8 +77,8 @@ TestDelegate call = () => new ProfileLocationReader(invalidFilePath); // Assert - var expectedMessage = string.Format("Fout bij het lezen van bestand '{0}': bestandspad mag niet de volgende tekens bevatten: {1}", - invalidFilePath, string.Join(", ", invalidPathChars)); + var expectedMessage = $"Fout bij het lezen van bestand '{invalidFilePath}': " + + "er zitten ongeldige tekens in het bestandspad. Alle tekens in het bestandspad moeten geldig zijn."; TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage); } Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/FailureMechanismSectionReaderTest.cs =================================================================== diff -u -r808d8de82712c31f26cf21ea82f849d7bb728caa -r7b85dbce8bcc39e824c367468892764778527ce4 --- Ringtoets/Common/test/Ringtoets.Common.IO.Test/FailureMechanismSectionReaderTest.cs (.../FailureMechanismSectionReaderTest.cs) (revision 808d8de82712c31f26cf21ea82f849d7bb728caa) +++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/FailureMechanismSectionReaderTest.cs (.../FailureMechanismSectionReaderTest.cs) (revision 7b85dbce8bcc39e824c367468892764778527ce4) @@ -77,8 +77,8 @@ TestDelegate call = () => new FailureMechanismSectionReader(invalidFilePath); // Assert - var expectedMessage = string.Format("Fout bij het lezen van bestand '{0}': bestandspad mag niet de volgende tekens bevatten: {1}", - invalidFilePath, string.Join(", ", invalidPathChars)); + var expectedMessage = $"Fout bij het lezen van bestand '{invalidFilePath}': " + + "er zitten ongeldige tekens in het bestandspad. Alle tekens in het bestandspad moeten geldig zijn."; TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage); } Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/FileImporters/HydraulicBoundaryDatabaseImporterTest.cs =================================================================== diff -u -r808d8de82712c31f26cf21ea82f849d7bb728caa -r7b85dbce8bcc39e824c367468892764778527ce4 --- Ringtoets/Common/test/Ringtoets.Common.IO.Test/FileImporters/HydraulicBoundaryDatabaseImporterTest.cs (.../HydraulicBoundaryDatabaseImporterTest.cs) (revision 808d8de82712c31f26cf21ea82f849d7bb728caa) +++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/FileImporters/HydraulicBoundaryDatabaseImporterTest.cs (.../HydraulicBoundaryDatabaseImporterTest.cs) (revision 7b85dbce8bcc39e824c367468892764778527ce4) @@ -123,8 +123,7 @@ // Assert var expectedMessage = new FileReaderErrorMessageBuilder(invalidPath) - .Build(string.Format(UtilsResources.Error_Path_cannot_contain_Characters_0_, - string.Join(", ", Path.GetInvalidPathChars()))); + .Build("Er zitten ongeldige tekens in het bestandspad. Alle tekens in het bestandspad moeten geldig zijn."); CriticalFileReadException exception = Assert.Throws(test); Assert.AreEqual(expectedMessage, exception.Message); Assert.IsInstanceOf(exception.InnerException); @@ -193,8 +192,8 @@ // Assert string expectedMessage = new FileReaderErrorMessageBuilder(validFilePath).Build(string.Format( - "Kon het rekeninstellingen bestand niet openen. Fout bij het lezen van bestand '{0}': het bestand bestaat niet.", - HydraulicDatabaseHelper.GetHydraulicBoundarySettingsDatabase(validFilePath))); + "Kon het rekeninstellingen bestand niet openen. Fout bij het lezen van bestand '{0}': het bestand bestaat niet.", + HydraulicDatabaseHelper.GetHydraulicBoundarySettingsDatabase(validFilePath))); CriticalFileReadException exception = Assert.Throws(test); Assert.AreEqual(expectedMessage, exception.Message); Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/FileImporters/ProfilesImporterTest.cs =================================================================== diff -u -r39bbb7b4108d845bf7834c1b92a983e35109271f -r7b85dbce8bcc39e824c367468892764778527ce4 --- Ringtoets/Common/test/Ringtoets.Common.IO.Test/FileImporters/ProfilesImporterTest.cs (.../ProfilesImporterTest.cs) (revision 39bbb7b4108d845bf7834c1b92a983e35109271f) +++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/FileImporters/ProfilesImporterTest.cs (.../ProfilesImporterTest.cs) (revision 7b85dbce8bcc39e824c367468892764778527ce4) @@ -129,9 +129,8 @@ TestHelper.AssertLogMessages(call, messages => { string message = messages.First(); - string invalidChars = string.Join(", ", invalidPathChars); string expectedMessage = new FileReaderErrorMessageBuilder(invalidPath) - .Build($"Bestandspad mag niet de volgende tekens bevatten: {invalidChars}"); + .Build("er zitten ongeldige tekens in het bestandspad. Alle tekens in het bestandspad moeten geldig zijn."); StringAssert.StartsWith(expectedMessage, message); }); Assert.IsFalse(importResult); Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/FileImporters/StructuresImporterTest.cs =================================================================== diff -u -r808d8de82712c31f26cf21ea82f849d7bb728caa -r7b85dbce8bcc39e824c367468892764778527ce4 --- Ringtoets/Common/test/Ringtoets.Common.IO.Test/FileImporters/StructuresImporterTest.cs (.../StructuresImporterTest.cs) (revision 808d8de82712c31f26cf21ea82f849d7bb728caa) +++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/FileImporters/StructuresImporterTest.cs (.../StructuresImporterTest.cs) (revision 7b85dbce8bcc39e824c367468892764778527ce4) @@ -131,7 +131,7 @@ { string message = messages.First(); string expectedMessage = new FileReaderErrorMessageBuilder(invalidPath) - .Build(string.Format(CoreCommonUtilsResources.Error_Path_cannot_contain_Characters_0_, string.Join(", ", invalidPathChars))); + .Build("Er zitten ongeldige tekens in het bestandspad. Alle tekens in het bestandspad moeten geldig zijn."); StringAssert.StartsWith(expectedMessage, message); }); Assert.IsFalse(importResult); @@ -585,7 +585,7 @@ string message = string.Format("De variatie voor parameter '{2}' van kunstwerk '{0}' ({1}) wordt omgerekend in een standaardafwijking (regel {3}).", structureName, parameter.LocationId, parameter.ParameterId, parameter.LineNumber); TestHelper.AssertLogMessageIsGenerated(call, message, 1); - double expectedStandardDeviation = parameter.VarianceValue*Math.Abs(parameter.NumericalValue); + double expectedStandardDeviation = parameter.VarianceValue * Math.Abs(parameter.NumericalValue); Assert.AreEqual(expectedStandardDeviation, standardDeviation, standardDeviation.GetAccuracy()); } @@ -654,7 +654,7 @@ string message = string.Format("De variatie voor parameter '{2}' van kunstwerk '{0}' ({1}) wordt omgerekend in een variatiecoƫfficiƫnt (regel {3}).", structureName, parameter.LocationId, parameter.ParameterId, parameter.LineNumber); TestHelper.AssertLogMessageIsGenerated(call, message, 1); - double expectedStandardDeviation = parameter.VarianceValue/Math.Abs(parameter.NumericalValue); + double expectedStandardDeviation = parameter.VarianceValue / Math.Abs(parameter.NumericalValue); Assert.AreEqual(expectedStandardDeviation, coefficientOfVariation, coefficientOfVariation.GetAccuracy()); } Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/ReferenceLines/ReferenceLineMetaImporterTest.cs =================================================================== diff -u -r39bbb7b4108d845bf7834c1b92a983e35109271f -r7b85dbce8bcc39e824c367468892764778527ce4 --- Ringtoets/Common/test/Ringtoets.Common.IO.Test/ReferenceLines/ReferenceLineMetaImporterTest.cs (.../ReferenceLineMetaImporterTest.cs) (revision 39bbb7b4108d845bf7834c1b92a983e35109271f) +++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/ReferenceLines/ReferenceLineMetaImporterTest.cs (.../ReferenceLineMetaImporterTest.cs) (revision 7b85dbce8bcc39e824c367468892764778527ce4) @@ -67,8 +67,8 @@ TestDelegate call = () => new ReferenceLineMetaImporter(invalidFilePath); // Assert - string invalidChars = string.Join(", ", invalidPathChars); - var expectedMessage = $"Fout bij het lezen van bestand '{invalidFilePath}': bestandspad mag niet de volgende tekens bevatten: {invalidChars}"; + var expectedMessage = $"Fout bij het lezen van bestand '{invalidFilePath}': " + + "er zitten ongeldige tekens in het bestandspad. Alle tekens in het bestandspad moeten geldig zijn."; TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage); } Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/ReferenceLines/ReferenceLineReaderTest.cs =================================================================== diff -u -r808d8de82712c31f26cf21ea82f849d7bb728caa -r7b85dbce8bcc39e824c367468892764778527ce4 --- Ringtoets/Common/test/Ringtoets.Common.IO.Test/ReferenceLines/ReferenceLineReaderTest.cs (.../ReferenceLineReaderTest.cs) (revision 808d8de82712c31f26cf21ea82f849d7bb728caa) +++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/ReferenceLines/ReferenceLineReaderTest.cs (.../ReferenceLineReaderTest.cs) (revision 7b85dbce8bcc39e824c367468892764778527ce4) @@ -88,8 +88,8 @@ TestDelegate call = () => reader.ReadReferenceLine(invalidFilePath); // Assert - var expectedMessage = string.Format("Fout bij het lezen van bestand '{0}': bestandspad mag niet de volgende tekens bevatten: {1}", - invalidFilePath, string.Join(", ", invalidPathChars)); + var expectedMessage = $"Fout bij het lezen van bestand '{invalidFilePath}': " + + "er zitten ongeldige tekens in het bestandspad. Alle tekens in het bestandspad moeten geldig zijn."; TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage); } Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/ReferenceLines/ReferenceLinesMetaReaderTest.cs =================================================================== diff -u -r808d8de82712c31f26cf21ea82f849d7bb728caa -r7b85dbce8bcc39e824c367468892764778527ce4 --- Ringtoets/Common/test/Ringtoets.Common.IO.Test/ReferenceLines/ReferenceLinesMetaReaderTest.cs (.../ReferenceLinesMetaReaderTest.cs) (revision 808d8de82712c31f26cf21ea82f849d7bb728caa) +++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/ReferenceLines/ReferenceLinesMetaReaderTest.cs (.../ReferenceLinesMetaReaderTest.cs) (revision 7b85dbce8bcc39e824c367468892764778527ce4) @@ -65,8 +65,8 @@ TestDelegate call = () => ReferenceLinesMetaReader.ReadReferenceLinesMetas(invalidFilePath); // Assert - var expectedMessage = string.Format("Fout bij het lezen van bestand '{0}': bestandspad mag niet de volgende tekens bevatten: {1}", - invalidFilePath, string.Join(", ", invalidPathChars)); + var expectedMessage = $"Fout bij het lezen van bestand '{invalidFilePath}': " + + "er zitten ongeldige tekens in het bestandspad. Alle tekens in het bestandspad moeten geldig zijn."; TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage); } Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/Structures/StructureLocationReaderTest.cs =================================================================== diff -u -r808d8de82712c31f26cf21ea82f849d7bb728caa -r7b85dbce8bcc39e824c367468892764778527ce4 --- Ringtoets/Common/test/Ringtoets.Common.IO.Test/Structures/StructureLocationReaderTest.cs (.../StructureLocationReaderTest.cs) (revision 808d8de82712c31f26cf21ea82f849d7bb728caa) +++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/Structures/StructureLocationReaderTest.cs (.../StructureLocationReaderTest.cs) (revision 7b85dbce8bcc39e824c367468892764778527ce4) @@ -77,8 +77,8 @@ TestDelegate call = () => new StructureLocationReader(invalidFilePath); // Assert - var expectedMessage = string.Format("Fout bij het lezen van bestand '{0}': bestandspad mag niet de volgende tekens bevatten: {1}", - invalidFilePath, string.Join(", ", invalidPathChars)); + var expectedMessage = $"Fout bij het lezen van bestand '{invalidFilePath}': " + + "er zitten ongeldige tekens in het bestandspad. Alle tekens in het bestandspad moeten geldig zijn."; TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage); } Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/Structures/StructuresCharacteristicsCsvReaderTest.cs =================================================================== diff -u -r808d8de82712c31f26cf21ea82f849d7bb728caa -r7b85dbce8bcc39e824c367468892764778527ce4 --- Ringtoets/Common/test/Ringtoets.Common.IO.Test/Structures/StructuresCharacteristicsCsvReaderTest.cs (.../StructuresCharacteristicsCsvReaderTest.cs) (revision 808d8de82712c31f26cf21ea82f849d7bb728caa) +++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/Structures/StructuresCharacteristicsCsvReaderTest.cs (.../StructuresCharacteristicsCsvReaderTest.cs) (revision 7b85dbce8bcc39e824c367468892764778527ce4) @@ -63,8 +63,7 @@ TestDelegate call = () => new StructuresCharacteristicsCsvReader(corruptPath); // Assert - string innerExpectedMessage = string.Format(UtilsResources.Error_Path_cannot_contain_Characters_0_, - string.Join(", ", Path.GetInvalidPathChars())); + string innerExpectedMessage = "Er zitten ongeldige tekens in het bestandspad. Alle tekens in het bestandspad moeten geldig zijn."; string expectedMessage = new FileReaderErrorMessageBuilder(corruptPath).Build(innerExpectedMessage); TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage); } Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Readers/PipingConfigurationReaderTest.cs =================================================================== diff -u -r023af77f9d53df64531a85b1f07b4b0948909401 -r7b85dbce8bcc39e824c367468892764778527ce4 --- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Readers/PipingConfigurationReaderTest.cs (.../PipingConfigurationReaderTest.cs) (revision 023af77f9d53df64531a85b1f07b4b0948909401) +++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Readers/PipingConfigurationReaderTest.cs (.../PipingConfigurationReaderTest.cs) (revision 7b85dbce8bcc39e824c367468892764778527ce4) @@ -65,7 +65,8 @@ TestDelegate call = () => new PipingConfigurationReader(invalidFilePath); // Assert - string expectedMessage = $"Fout bij het lezen van bestand '{invalidFilePath}': bestandspad mag niet de volgende tekens bevatten: {string.Join(", ", invalidPathChars)}"; + string expectedMessage = $"Fout bij het lezen van bestand '{invalidFilePath}': " + + "er zitten ongeldige tekens in het bestandspad. Alle tekens in het bestandspad moeten geldig zijn."; TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage); } Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/SurfaceLines/CharacteristicPointsCsvReaderTest.cs =================================================================== diff -u -r808d8de82712c31f26cf21ea82f849d7bb728caa -r7b85dbce8bcc39e824c367468892764778527ce4 --- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/SurfaceLines/CharacteristicPointsCsvReaderTest.cs (.../CharacteristicPointsCsvReaderTest.cs) (revision 808d8de82712c31f26cf21ea82f849d7bb728caa) +++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/SurfaceLines/CharacteristicPointsCsvReaderTest.cs (.../CharacteristicPointsCsvReaderTest.cs) (revision 7b85dbce8bcc39e824c367468892764778527ce4) @@ -65,8 +65,7 @@ TestDelegate call = () => new CharacteristicPointsCsvReader(corruptPath); // Assert - string innerErrorMessage = string.Format(UtilsResources.Error_Path_cannot_contain_Characters_0_, - string.Join(", ", Path.GetInvalidPathChars())); + string innerErrorMessage = "Er zitten ongeldige tekens in het bestandspad. Alle tekens in het bestandspad moeten geldig zijn."; string expectedMessage = new FileReaderErrorMessageBuilder(corruptPath).Build(innerErrorMessage); TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage); } Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/SurfaceLines/PipingSurfaceLinesCsvReaderTest.cs =================================================================== diff -u -r808d8de82712c31f26cf21ea82f849d7bb728caa -r7b85dbce8bcc39e824c367468892764778527ce4 --- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/SurfaceLines/PipingSurfaceLinesCsvReaderTest.cs (.../PipingSurfaceLinesCsvReaderTest.cs) (revision 808d8de82712c31f26cf21ea82f849d7bb728caa) +++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/SurfaceLines/PipingSurfaceLinesCsvReaderTest.cs (.../PipingSurfaceLinesCsvReaderTest.cs) (revision 7b85dbce8bcc39e824c367468892764778527ce4) @@ -67,8 +67,7 @@ TestDelegate call = () => new PipingSurfaceLinesCsvReader(corruptPath); // Assert - string innerExpectedMessage = string.Format(UtilsResources.Error_Path_cannot_contain_Characters_0_, - string.Join(", ", Path.GetInvalidPathChars())); + string innerExpectedMessage = "Er zitten ongeldige tekens in het bestandspad. Alle tekens in het bestandspad moeten geldig zijn."; string expectedMessage = new FileReaderErrorMessageBuilder(corruptPath).Build(innerExpectedMessage); TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage); } Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/PipingSurfaceLinesCsvImporterTest.cs =================================================================== diff -u -r808d8de82712c31f26cf21ea82f849d7bb728caa -r7b85dbce8bcc39e824c367468892764778527ce4 --- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/PipingSurfaceLinesCsvImporterTest.cs (.../PipingSurfaceLinesCsvImporterTest.cs) (revision 808d8de82712c31f26cf21ea82f849d7bb728caa) +++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/PipingSurfaceLinesCsvImporterTest.cs (.../PipingSurfaceLinesCsvImporterTest.cs) (revision 7b85dbce8bcc39e824c367468892764778527ce4) @@ -59,9 +59,9 @@ // Call TestDelegate call = () => new PipingSurfaceLinesCsvImporter(null, - referenceLine, - string.Empty, - new TestSurfaceLineUpdateStrategy()); + referenceLine, + string.Empty, + new TestSurfaceLineUpdateStrategy()); // Assert string parameter = Assert.Throws(call).ParamName; @@ -76,9 +76,9 @@ // Call TestDelegate call = () => new PipingSurfaceLinesCsvImporter(collection, - null, - string.Empty, - new TestSurfaceLineUpdateStrategy()); + null, + string.Empty, + new TestSurfaceLineUpdateStrategy()); // Assert string parameter = Assert.Throws(call).ParamName; @@ -94,9 +94,9 @@ // Call TestDelegate call = () => new PipingSurfaceLinesCsvImporter(collection, - referenceLine, - string.Empty, - null); + referenceLine, + string.Empty, + null); // Assert string parameter = Assert.Throws(call).ParamName; @@ -420,8 +420,8 @@ Action call = () => importResult = importer.Import(); // Assert - string internalErrorMessage = new FileReaderErrorMessageBuilder(corruptPath).Build(string.Format(UtilsResources.Error_Path_cannot_contain_Characters_0_, - string.Join(", ", Path.GetInvalidPathChars()))); + string internalErrorMessage = new FileReaderErrorMessageBuilder(corruptPath) + .Build("Er zitten ongeldige tekens in het bestandspad. Alle tekens in het bestandspad moeten geldig zijn."); var expectedLogMessage = string.Format(PipingPluginResources.PipingSurfaceLinesCsvImporter_CriticalErrorMessage_0_File_Skipped, internalErrorMessage); TestHelper.AssertLogMessageIsGenerated(call, expectedLogMessage, 1);