Index: Core/Common/test/Core.Common.Utils.Test/IOUtilsTest.cs =================================================================== diff -u -r808d8de82712c31f26cf21ea82f849d7bb728caa -r39bbb7b4108d845bf7834c1b92a983e35109271f --- Core/Common/test/Core.Common.Utils.Test/IOUtilsTest.cs (.../IOUtilsTest.cs) (revision 808d8de82712c31f26cf21ea82f849d7bb728caa) +++ Core/Common/test/Core.Common.Utils.Test/IOUtilsTest.cs (.../IOUtilsTest.cs) (revision 39bbb7b4108d845bf7834c1b92a983e35109271f) @@ -240,12 +240,12 @@ } [Test] - public void IsValidFilePath_PathContainingInvalidFileCharacters_ReturnsFalse() + public void IsValidFilePath_PathContainingInvalidPathCharacters_ReturnsFalse() { // Setup string path = TestHelper.GetTestDataPath(TestDataPath.Core.Common.Utils, "validFile.txt"); - char[] invalidFileNameChars = Path.GetInvalidFileNameChars(); - string invalidPath = path.Replace('d', invalidFileNameChars[0]); + char[] invalidPathChars = Path.GetInvalidPathChars(); + string invalidPath = path.Replace('d', invalidPathChars[0]); // Call bool valid = IOUtils.IsValidFilePath(invalidPath); Index: Core/Components/test/Core.Components.DotSpatial.Forms.Test/IO/WmtsConnectionInfoReaderTest.cs =================================================================== diff -u -r808d8de82712c31f26cf21ea82f849d7bb728caa -r39bbb7b4108d845bf7834c1b92a983e35109271f --- Core/Components/test/Core.Components.DotSpatial.Forms.Test/IO/WmtsConnectionInfoReaderTest.cs (.../WmtsConnectionInfoReaderTest.cs) (revision 808d8de82712c31f26cf21ea82f849d7bb728caa) +++ Core/Components/test/Core.Components.DotSpatial.Forms.Test/IO/WmtsConnectionInfoReaderTest.cs (.../WmtsConnectionInfoReaderTest.cs) (revision 39bbb7b4108d845bf7834c1b92a983e35109271f) @@ -72,19 +72,16 @@ public void ReadWmtsConnectionInfos_FilePathHasInvalidPathCharacter_ThrowArgumentException() { // Setup - char[] invalidFileNameChars = Path.GetInvalidFileNameChars(); - string invalidCharacter = invalidFileNameChars[0].ToString(); - var filePath = "c:/_.config".Replace("_", invalidCharacter); + char[] invalidPathChars = Path.GetInvalidPathChars(); + var filePath = "c:/_.config".Replace('_', invalidPathChars[0]); var reader = new WmtsConnectionInfoReader(); // Call TestDelegate call = () => reader.ReadWmtsConnectionInfos(filePath); // Assert - const string expectedMessage = "Fout bij het lezen van bestand 'c:/\".config': bestandspad " + - "mag niet de volgende tekens bevatten: \", <, >, " + - "|, \0, , , , , , , \a, \b, \t, \n, \v, \f, \r, " + - ", , , , , , , , , , , , , , , , , "; + string invalidChars = string.Join(", ", invalidPathChars); + var expectedMessage = $"Fout bij het lezen van bestand 'c:/\".config': bestandspad mag niet de volgende tekens bevatten: {invalidChars}"; TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage); } Index: Core/Components/test/Core.Components.DotSpatial.Forms.Test/IO/WmtsConnectionInfoWriterTest.cs =================================================================== diff -u -r808d8de82712c31f26cf21ea82f849d7bb728caa -r39bbb7b4108d845bf7834c1b92a983e35109271f --- Core/Components/test/Core.Components.DotSpatial.Forms.Test/IO/WmtsConnectionInfoWriterTest.cs (.../WmtsConnectionInfoWriterTest.cs) (revision 808d8de82712c31f26cf21ea82f849d7bb728caa) +++ Core/Components/test/Core.Components.DotSpatial.Forms.Test/IO/WmtsConnectionInfoWriterTest.cs (.../WmtsConnectionInfoWriterTest.cs) (revision 39bbb7b4108d845bf7834c1b92a983e35109271f) @@ -66,18 +66,15 @@ public void Constructor_FilePathHasInvalidPathCharacter_ThrowArgumentException() { // Setup - char[] invalidFileNameChars = Path.GetInvalidFileNameChars(); - string invalidCharacter = invalidFileNameChars[0].ToString(); - var filePath = "c:/_.config".Replace("_", invalidCharacter); + char[] invalidPathChars = Path.GetInvalidPathChars(); + var filePath = "c:/_.config".Replace('_', invalidPathChars[0]); // Call TestDelegate call = () => new WmtsConnectionInfoWriter(filePath); // Assert - const string expectedMessage = "Fout bij het lezen van bestand 'c:/\".config': bestandspad " + - "mag niet de volgende tekens bevatten: \", <, >, " + - "|, \0, , , , , , , \a, \b, \t, \n, \v, \f, \r, " + - ", , , , , , , , , , , , , , , , , "; + string invalidChars = string.Join(", ", invalidPathChars); + var expectedMessage = $"Fout bij het lezen van bestand '{filePath}': bestandspad mag niet de volgende tekens bevatten: {invalidChars}"; TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage); } Index: Core/Components/test/Core.Components.Gis.IO.Test/Writers/ShapeFileWriterBaseTest.cs =================================================================== diff -u -r808d8de82712c31f26cf21ea82f849d7bb728caa -r39bbb7b4108d845bf7834c1b92a983e35109271f --- Core/Components/test/Core.Components.Gis.IO.Test/Writers/ShapeFileWriterBaseTest.cs (.../ShapeFileWriterBaseTest.cs) (revision 808d8de82712c31f26cf21ea82f849d7bb728caa) +++ Core/Components/test/Core.Components.Gis.IO.Test/Writers/ShapeFileWriterBaseTest.cs (.../ShapeFileWriterBaseTest.cs) (revision 39bbb7b4108d845bf7834c1b92a983e35109271f) @@ -116,17 +116,17 @@ public void SaveAs_FilePathHasInvalidPathCharacter_ThrowArgumentException() { // Setup - char[] invalidFileNameChars = Path.GetInvalidFileNameChars(); - string invalidCharacter = invalidFileNameChars[0].ToString(); - var filePath = "c:/_.shp".Replace("_", invalidCharacter); + char[] invalidPathChars = Path.GetInvalidPathChars(); + var filePath = "c:/_.shp".Replace('_', invalidPathChars[0]); using (var writer = new TestShapeFileWriterBase()) { // Call TestDelegate call = () => writer.SaveAs(filePath); // Assert - const string expectedMessage = "Fout bij het lezen van bestand 'c:/\".shp': bestandspad mag niet de volgende tekens bevatten: \", <, >, |, \0, , , , , , , \a, \b, \t, \n, \v, \f, \r, , , , , , , , , , , , , , , , , , "; + string invalidChars = string.Join(", ", invalidPathChars); + var expectedMessage = $"Fout bij het lezen van bestand 'c:/\".shp': bestandspad mag niet de volgende tekens bevatten: {invalidChars}"; TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage); } } Index: Ringtoets/Common/src/Ringtoets.Common.IO/ReferenceLines/ReferenceLineMetaImporter.cs =================================================================== diff -u -r4e578730273a943bb02a2861c694a2707c8ef852 -r39bbb7b4108d845bf7834c1b92a983e35109271f --- Ringtoets/Common/src/Ringtoets.Common.IO/ReferenceLines/ReferenceLineMetaImporter.cs (.../ReferenceLineMetaImporter.cs) (revision 4e578730273a943bb02a2861c694a2707c8ef852) +++ Ringtoets/Common/src/Ringtoets.Common.IO/ReferenceLines/ReferenceLineMetaImporter.cs (.../ReferenceLineMetaImporter.cs) (revision 39bbb7b4108d845bf7834c1b92a983e35109271f) @@ -113,7 +113,7 @@ { var message = new FileReaderErrorMessageBuilder(path) .Build(string.Format(Resources.Error_Path_cannot_contain_Characters_0_, - string.Join(", ", Path.GetInvalidFileNameChars()))); + string.Join(", ", Path.GetInvalidPathChars()))); throw new ArgumentException(message, e); } catch (Exception e) Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/FileImporters/ProfilesImporterTest.cs =================================================================== diff -u -r808d8de82712c31f26cf21ea82f849d7bb728caa -r39bbb7b4108d845bf7834c1b92a983e35109271f --- Ringtoets/Common/test/Ringtoets.Common.IO.Test/FileImporters/ProfilesImporterTest.cs (.../ProfilesImporterTest.cs) (revision 808d8de82712c31f26cf21ea82f849d7bb728caa) +++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/FileImporters/ProfilesImporterTest.cs (.../ProfilesImporterTest.cs) (revision 39bbb7b4108d845bf7834c1b92a983e35109271f) @@ -114,10 +114,10 @@ public void Import_FromPathContainingInvalidPathCharacters_FalseAndLogError() { // Setup - string filePath = "c:\\Invalid_Characters.shp"; + const string filePath = "c:\\Invalid_Characters.shp"; - var invalidFileNameChars = Path.GetInvalidPathChars(); - var invalidPath = filePath.Replace('_', invalidFileNameChars[0]); + var invalidPathChars = Path.GetInvalidPathChars(); + var invalidPath = filePath.Replace('_', invalidPathChars[0]); var testProfilesImporter = new TestProfilesImporter(testImportTarget, testReferenceLine, invalidPath); @@ -129,8 +129,9 @@ TestHelper.AssertLogMessages(call, messages => { string message = messages.First(); + string invalidChars = string.Join(", ", invalidPathChars); string expectedMessage = new FileReaderErrorMessageBuilder(invalidPath) - .Build(string.Format(CoreCommonUtilsResources.Error_Path_cannot_contain_Characters_0_, string.Join(", ", Path.GetInvalidPathChars()))); + .Build($"Bestandspad mag niet de volgende tekens bevatten: {invalidChars}"); StringAssert.StartsWith(expectedMessage, message); }); Assert.IsFalse(importResult); Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/ReferenceLines/ReferenceLineMetaImporterTest.cs =================================================================== diff -u -r2aa9661130f20e88c41dac921ffb780573dcf799 -r39bbb7b4108d845bf7834c1b92a983e35109271f --- Ringtoets/Common/test/Ringtoets.Common.IO.Test/ReferenceLines/ReferenceLineMetaImporterTest.cs (.../ReferenceLineMetaImporterTest.cs) (revision 2aa9661130f20e88c41dac921ffb780573dcf799) +++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/ReferenceLines/ReferenceLineMetaImporterTest.cs (.../ReferenceLineMetaImporterTest.cs) (revision 39bbb7b4108d845bf7834c1b92a983e35109271f) @@ -57,18 +57,18 @@ public void Constructor_FilePathHasInvalidPathCharacter_ThrowsArgumentException() { // Setup - char[] invalidFileNameChars = Path.GetInvalidFileNameChars(); + char[] invalidPathChars = Path.GetInvalidPathChars(); string validFilePath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Common.IO, "SomeFolder"); - string invalidFilePath = validFilePath.Replace("F", invalidFileNameChars[1].ToString()); + string invalidFilePath = validFilePath.Replace('F', invalidPathChars.Last()); // Call TestDelegate call = () => new ReferenceLineMetaImporter(invalidFilePath); // Assert - var expectedMessage = string.Format("Fout bij het lezen van bestand '{0}': bestandspad mag niet de volgende tekens bevatten: {1}", - invalidFilePath, string.Join(", ", invalidFileNameChars)); + string invalidChars = string.Join(", ", invalidPathChars); + var expectedMessage = $"Fout bij het lezen van bestand '{invalidFilePath}': bestandspad mag niet de volgende tekens bevatten: {invalidChars}"; TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage); } Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Importers/StochasticSoilModelImporterTest.cs =================================================================== diff -u -re1a8e98d60853beefbdb8c84e70f14165680ad7b -r39bbb7b4108d845bf7834c1b92a983e35109271f --- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Importers/StochasticSoilModelImporterTest.cs (.../StochasticSoilModelImporterTest.cs) (revision e1a8e98d60853beefbdb8c84e70f14165680ad7b) +++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Importers/StochasticSoilModelImporterTest.cs (.../StochasticSoilModelImporterTest.cs) (revision 39bbb7b4108d845bf7834c1b92a983e35109271f) @@ -124,7 +124,7 @@ } [Test] - public void Import_FromInvalidFileName_LogError() + public void Import_FromInvalidFilePath_LogError() { // Setup const string file = "/";