Index: Application/Ringtoets/test/Application.Ringtoets.Migration.Test/RingtoetsSqLiteDatabaseFileMigratorTest.cs =================================================================== diff -u -rd18995d638a6c3f99cb7a8419107bb4148420301 -r27a3de13b3b94459fc79664d521de3790dd6b0df --- Application/Ringtoets/test/Application.Ringtoets.Migration.Test/RingtoetsSqLiteDatabaseFileMigratorTest.cs (.../RingtoetsSqLiteDatabaseFileMigratorTest.cs) (revision d18995d638a6c3f99cb7a8419107bb4148420301) +++ Application/Ringtoets/test/Application.Ringtoets.Migration.Test/RingtoetsSqLiteDatabaseFileMigratorTest.cs (.../RingtoetsSqLiteDatabaseFileMigratorTest.cs) (revision 27a3de13b3b94459fc79664d521de3790dd6b0df) @@ -107,7 +107,7 @@ string sourceFilePath = TestHelper.GetTestDataPath(TestDataPath.Application.Ringtoets.Migration, "FullTestProject164.rtd"); var fromVersionedFile = new RingtoetsVersionedFile(sourceFilePath); - string targetFilePath = TestHelper.GetScratchPadPath(Path.GetRandomFileName()); + string targetFilePath = TestHelper.GetScratchPadPath(nameof(Migrate_ValidFiles_SavesFileAtNewLocation)); var migrator = new RingtoetsSqLiteDatabaseFileMigrator(); using (new FileDisposeHelper(targetFilePath)) @@ -129,7 +129,7 @@ string sourceFilePath = TestHelper.GetTestDataPath(TestDataPath.Application.Ringtoets.Migration, "FullTestProject164.rtd"); var fromVersionedFile = new RingtoetsVersionedFile(sourceFilePath); - string targetFilePath = TestHelper.GetScratchPadPath(Path.GetRandomFileName()); + string targetFilePath = TestHelper.GetScratchPadPath(nameof(Migrate_TargetFileInUse_ThrowsCriticalDatabaseMigrationException)); var migrator = new RingtoetsSqLiteDatabaseFileMigrator(); using (var fileDisposeHelper = new FileDisposeHelper(targetFilePath)) @@ -174,7 +174,7 @@ string sourceFilePath = TestHelper.GetTestDataPath(TestDataPath.Application.Ringtoets.Migration, "FullTestProject164.rtd"); var fromVersionedFile = new RingtoetsVersionedFile(sourceFilePath); - string targetFilePath = TestHelper.GetScratchPadPath(Path.GetRandomFileName()); + string targetFilePath = TestHelper.GetScratchPadPath(nameof(Migrate_TargetFileNotWritable_ThrowsCriticalDatabaseMigrationException)); var migrator = new RingtoetsSqLiteDatabaseFileMigrator(); using (new FileDisposeHelper(targetFilePath)) @@ -210,7 +210,7 @@ string sourceFilePath = TestHelper.GetTestDataPath(TestDataPath.Application.Ringtoets.Migration, "FullTestProject164.rtd"); var fromVersionedFile = new RingtoetsVersionedFile(sourceFilePath); - string targetFilePath = TestHelper.GetScratchPadPath(Path.GetRandomFileName()); + string targetFilePath = TestHelper.GetScratchPadPath(nameof(Migrate_InvalidToVersion_ThrowsCriticalDatabaseMigrationException)); var migrator = new RingtoetsSqLiteDatabaseFileMigrator(); // Call @@ -228,7 +228,7 @@ string sourceFilePath = TestHelper.GetTestDataPath(TestDataPath.Application.Ringtoets.Migration, "UnsupportedVersion8.rtd"); var fromVersionedFile = new RingtoetsVersionedFile(sourceFilePath); - string targetFilePath = TestHelper.GetScratchPadPath(Path.GetRandomFileName()); + string targetFilePath = TestHelper.GetScratchPadPath(nameof(Migrate_UnsupportedVersion_ThrowsCriticalDatabaseMigrationException)); var migrator = new RingtoetsSqLiteDatabaseFileMigrator(); // Call Index: Application/Ringtoets/test/Application.Ringtoets.MigrationConsole.Test/RingtoetsMigrationConsoleTest.cs =================================================================== diff -u -rd18995d638a6c3f99cb7a8419107bb4148420301 -r27a3de13b3b94459fc79664d521de3790dd6b0df --- Application/Ringtoets/test/Application.Ringtoets.MigrationConsole.Test/RingtoetsMigrationConsoleTest.cs (.../RingtoetsMigrationConsoleTest.cs) (revision d18995d638a6c3f99cb7a8419107bb4148420301) +++ Application/Ringtoets/test/Application.Ringtoets.MigrationConsole.Test/RingtoetsMigrationConsoleTest.cs (.../RingtoetsMigrationConsoleTest.cs) (revision 27a3de13b3b94459fc79664d521de3790dd6b0df) @@ -165,7 +165,7 @@ { // Given string sourceFilePath = TestHelper.GetTestDataPath(TestDataPath.Application.Ringtoets.Migration, "FullTestProject164.rtd"); - string targetFilePath = TestHelper.GetScratchPadPath(Path.GetRandomFileName()); + string targetFilePath = TestHelper.GetScratchPadPath($"{nameof(RingtoetsMigrationConsoleTest)}.{nameof(GivenConsole_WhenMigrateCalledWithArguments_MigratesToNewVersion)}"); var console = new RingtoetsMigrationConsole(); string expectedVersion = RingtoetsVersionHelper.GetCurrentDatabaseVersion(); @@ -199,7 +199,7 @@ { // Given string sourceFilePath = TestHelper.GetTestDataPath(TestDataPath.Application.Ringtoets.Migration, "FullTestProject164.rtd"); - string targetFilePath = TestHelper.GetScratchPadPath(Path.GetRandomFileName()); + string targetFilePath = TestHelper.GetScratchPadPath($"{nameof(RingtoetsMigrationConsoleTest)}.{nameof(GivenConsole_WhenMigrateCalledUnableToSaveTarget_ThenExitWithErrorCode)}"); var console = new RingtoetsMigrationConsole(); Index: Application/Ringtoets/test/Application.Ringtoets.MigrationConsole.Test/RingtoetsMigrationToolTest.cs =================================================================== diff -u -rd18995d638a6c3f99cb7a8419107bb4148420301 -r27a3de13b3b94459fc79664d521de3790dd6b0df --- Application/Ringtoets/test/Application.Ringtoets.MigrationConsole.Test/RingtoetsMigrationToolTest.cs (.../RingtoetsMigrationToolTest.cs) (revision d18995d638a6c3f99cb7a8419107bb4148420301) +++ Application/Ringtoets/test/Application.Ringtoets.MigrationConsole.Test/RingtoetsMigrationToolTest.cs (.../RingtoetsMigrationToolTest.cs) (revision 27a3de13b3b94459fc79664d521de3790dd6b0df) @@ -125,7 +125,7 @@ { // Given string sourceFilePath = TestHelper.GetTestDataPath(testPath, "FullTestProject164.rtd"); - string targetFilePath = TestHelper.GetScratchPadPath(Path.GetRandomFileName()); + string targetFilePath = TestHelper.GetScratchPadPath($"{nameof(RingtoetsMigrationToolTest)}.{nameof(GivenConsole_WhenMigrateCalledWithArguments_MigratesToNewVersion)}"); string expectedVersion = RingtoetsVersionHelper.GetCurrentDatabaseVersion(); using (new FileDisposeHelper(targetFilePath)) @@ -158,7 +158,7 @@ { // Given string sourceFilePath = TestHelper.GetTestDataPath(testPath, "FullTestProject164.rtd"); - string targetFilePath = TestHelper.GetScratchPadPath(Path.GetRandomFileName()); + string targetFilePath = TestHelper.GetScratchPadPath($"{nameof(RingtoetsMigrationToolTest)}.{nameof(GivenConsole_WhenMigrateCalledUnableToSaveTarget_ThenExitWithErrorCode)}"); using (var fileDisposeHelper = new FileDisposeHelper(targetFilePath)) using (var consoleOutput = new ConsoleOutput()) Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/StorageMigrationIntegrationTest.cs =================================================================== diff -u -r3a1d4488d68236efe6eccbd60be3484735aa689b -r27a3de13b3b94459fc79664d521de3790dd6b0df --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/StorageMigrationIntegrationTest.cs (.../StorageMigrationIntegrationTest.cs) (revision 3a1d4488d68236efe6eccbd60be3484735aa689b) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/StorageMigrationIntegrationTest.cs (.../StorageMigrationIntegrationTest.cs) (revision 27a3de13b3b94459fc79664d521de3790dd6b0df) @@ -40,7 +40,7 @@ [Apartment(ApartmentState.STA)] public void GivenRingtoetsGuiWithStorageSql_WhenRunWithMigratedFile_MigratedProjectSet() { - string targetFilePath = TestHelper.GetScratchPadPath(Path.GetRandomFileName()); + string targetFilePath = TestHelper.GetScratchPadPath(nameof(GivenRingtoetsGuiWithStorageSql_WhenRunWithMigratedFile_MigratedProjectSet)); using (new FileDisposeHelper(targetFilePath)) { string sourceFilePath = TestHelper.GetTestDataPath(TestDataPath.Application.Ringtoets.Migration, "FullTestProject164.rtd"); Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/StorageSqLiteTest.cs =================================================================== diff -u -rd18995d638a6c3f99cb7a8419107bb4148420301 -r27a3de13b3b94459fc79664d521de3790dd6b0df --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/StorageSqLiteTest.cs (.../StorageSqLiteTest.cs) (revision d18995d638a6c3f99cb7a8419107bb4148420301) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/StorageSqLiteTest.cs (.../StorageSqLiteTest.cs) (revision 27a3de13b3b94459fc79664d521de3790dd6b0df) @@ -102,7 +102,7 @@ public void LoadProject_RingtoetsFileWithTwoProjects_ThrowsStorageExceptionAndStorageValidationException() { // Setup - string tempRingtoetsFile = TestHelper.GetScratchPadPath(Path.GetRandomFileName()); + string tempRingtoetsFile = TestHelper.GetScratchPadPath(nameof(LoadProject_RingtoetsFileWithTwoProjects_ThrowsStorageExceptionAndStorageValidationException)); using (new FileDisposeHelper(tempRingtoetsFile)) { try @@ -131,7 +131,7 @@ public void LoadProject_CorruptRingtoetsFileThatPassesValidation_ThrowsStorageExceptionWithFullStackTrace() { // Setup - string tempRingtoetsFile = TestHelper.GetScratchPadPath(Path.GetRandomFileName()); + string tempRingtoetsFile = TestHelper.GetScratchPadPath(nameof(LoadProject_CorruptRingtoetsFileThatPassesValidation_ThrowsStorageExceptionWithFullStackTrace)); using (new FileDisposeHelper(tempRingtoetsFile)) { try @@ -167,7 +167,7 @@ public void LoadProject_DatabaseWithoutVersionEntities_ThrowStorageValidationException() { // Setup - string tempRingtoetsFile = TestHelper.GetScratchPadPath(Path.GetRandomFileName()); + string tempRingtoetsFile = TestHelper.GetScratchPadPath(nameof(LoadProject_DatabaseWithoutVersionEntities_ThrowStorageValidationException)); using (new FileDisposeHelper(tempRingtoetsFile)) { try @@ -196,7 +196,7 @@ public void LoadProject_DatabaseWithMultipleVersionEntities_ThrowStorageValidationException() { // Setup - string tempRingtoetsFile = TestHelper.GetScratchPadPath(Path.GetRandomFileName()); + string tempRingtoetsFile = TestHelper.GetScratchPadPath(nameof(LoadProject_DatabaseWithMultipleVersionEntities_ThrowStorageValidationException)); string currentDatabaseVersion = RingtoetsVersionHelper.GetCurrentDatabaseVersion(); using (new FileDisposeHelper(tempRingtoetsFile)) { @@ -233,7 +233,7 @@ public void LoadProject_DatabaseFromFutureVersion_ThrowStorageValidationException(int additionalVersionNumber) { // Setup - string tempRingtoetsFile = TestHelper.GetScratchPadPath(Path.GetRandomFileName()); + string tempRingtoetsFile = TestHelper.GetScratchPadPath($"{nameof(LoadProject_DatabaseFromFutureVersion_ThrowStorageValidationException)}_{Path.GetRandomFileName()}"); string currentDatabaseVersion = RingtoetsVersionHelper.GetCurrentDatabaseVersion(); var versionCode = additionalVersionNumber + currentDatabaseVersion; @@ -272,7 +272,7 @@ public void LoadProject_DatabaseWithInvalidVersionCode_ThrowStorageValidationException(string versionCode) { // Setup - string tempRingtoetsFile = TestHelper.GetScratchPadPath(Path.GetRandomFileName()); + string tempRingtoetsFile = TestHelper.GetScratchPadPath($"{nameof(LoadProject_DatabaseWithInvalidVersionCode_ThrowStorageValidationException)}_{Path.GetRandomFileName()}"); using (new FileDisposeHelper(tempRingtoetsFile)) { @@ -306,7 +306,7 @@ public void LoadProject_ValidDatabase_ReturnsProject() { // Setup - string tempRingtoetsFile = TestHelper.GetScratchPadPath(Path.GetRandomFileName()); + string tempRingtoetsFile = TestHelper.GetScratchPadPath(nameof(LoadProject_ValidDatabase_ReturnsProject)); var projectName = Path.GetFileNameWithoutExtension(tempRingtoetsFile); var storage = new StorageSqLite(); var mockRepository = new MockRepository(); @@ -373,7 +373,7 @@ public void SaveProjectAs_ValidPathToNonExistingFile_DoesNotThrowException() { // Setup - string tempRingtoetsFile = TestHelper.GetScratchPadPath(Path.GetRandomFileName()); + string tempRingtoetsFile = TestHelper.GetScratchPadPath(nameof(SaveProjectAs_ValidPathToNonExistingFile_DoesNotThrowException)); var project = new RingtoetsProject(); var storage = new StorageSqLite(); storage.StageProject(project); @@ -400,7 +400,7 @@ public void SaveProjectAs_ValidPathToExistingFile_DoesNotThrowException() { // Setup - string tempRingtoetsFile = TestHelper.GetScratchPadPath(Path.GetRandomFileName()); + string tempRingtoetsFile = TestHelper.GetScratchPadPath(nameof(SaveProjectAs_ValidPathToExistingFile_DoesNotThrowException)); var project = new RingtoetsProject(); var storage = new StorageSqLite(); storage.StageProject(project); @@ -429,7 +429,7 @@ public void SaveProjectAs_ValidPathToLockedFile_ThrowsUpdateStorageException() { // Setup - string tempRingtoetsFile = TestHelper.GetScratchPadPath(Path.GetRandomFileName()); + string tempRingtoetsFile = TestHelper.GetScratchPadPath(nameof(SaveProjectAs_ValidPathToLockedFile_ThrowsUpdateStorageException)); var project = new RingtoetsProject(); var storage = new StorageSqLite(); storage.StageProject(project); @@ -463,7 +463,7 @@ public void SaveProjectAs_NoStagedProject_ThrowInvalidOperationException() { // Setup - string tempRingtoetsFile = Path.Combine(testPath, Path.GetRandomFileName()); + string tempRingtoetsFile = TestHelper.GetScratchPadPath(nameof(SaveProjectAs_NoStagedProject_ThrowInvalidOperationException)); var storage = new StorageSqLite(); // Precondition @@ -532,7 +532,7 @@ // Setup StorageSqLite storageSqLite = new StorageSqLite(); RingtoetsProject storedProject = new RingtoetsProject(); - string tempRingtoetsFile = TestHelper.GetScratchPadPath(Path.GetRandomFileName()); + string tempRingtoetsFile = TestHelper.GetScratchPadPath(nameof(HasStagedProjectChanges_ValidProjectLoaded_ReturnsFalse)); using (new FileDisposeHelper(tempRingtoetsFile)) { @@ -562,7 +562,7 @@ StorageSqLite storageSqLite = new StorageSqLite(); RingtoetsProject storedProject = new RingtoetsProject(); var changedName = "some name"; - string tempRingtoetsFile = TestHelper.GetScratchPadPath(Path.GetRandomFileName()); + string tempRingtoetsFile = TestHelper.GetScratchPadPath(nameof(HasStagedProjectChanges_ValidProjectLoadedWithUnaffectedChange_ReturnsFalse)); using (new FileDisposeHelper(tempRingtoetsFile)) { @@ -593,7 +593,7 @@ StorageSqLite storageSqLite = new StorageSqLite(); RingtoetsProject storedProject = RingtoetsProjectTestHelper.GetFullTestProject(); var changedDescription = "some description"; - string tempRingtoetsFile = TestHelper.GetScratchPadPath(Path.GetRandomFileName()); + string tempRingtoetsFile = TestHelper.GetScratchPadPath(nameof(HasStagedProjectChanges_ValidProjectLoadedWithAffectedChange_ReturnsTrue)); using (new FileDisposeHelper(tempRingtoetsFile)) { @@ -626,7 +626,7 @@ var projectMock = mockRepository.StrictMock(); mockRepository.ReplayAll(); var storage = new StorageSqLite(); - string tempRingtoetsFile = TestHelper.GetScratchPadPath(Path.GetRandomFileName()); + string tempRingtoetsFile = TestHelper.GetScratchPadPath(nameof(HasStagedProjectChanges_SavedToEmptyDatabaseFile_ReturnsFalse)); using (new FileDisposeHelper(tempRingtoetsFile)) { Index: Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil.Test/SqLiteDatabaseHelperTest.cs =================================================================== diff -u -rd18995d638a6c3f99cb7a8419107bb4148420301 -r27a3de13b3b94459fc79664d521de3790dd6b0df --- Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil.Test/SqLiteDatabaseHelperTest.cs (.../SqLiteDatabaseHelperTest.cs) (revision d18995d638a6c3f99cb7a8419107bb4148420301) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil.Test/SqLiteDatabaseHelperTest.cs (.../SqLiteDatabaseHelperTest.cs) (revision 27a3de13b3b94459fc79664d521de3790dd6b0df) @@ -228,7 +228,7 @@ public void CreateDatabaseFile_FileAlreadyExistsAndLocked_Fail() { // Setup - string validPath = TestHelper.GetScratchPadPath(Path.GetRandomFileName()); + string validPath = TestHelper.GetScratchPadPath(nameof(CreateDatabaseFile_FileAlreadyExistsAndLocked_Fail)); const string validScript = ";"; using (var fileDisposeHelper = new FileDisposeHelper(validPath)) Index: Core/Common/test/Core.Common.Gui.Test/Commands/StorageCommandHandlerTest.cs =================================================================== diff -u -rd18995d638a6c3f99cb7a8419107bb4148420301 -r27a3de13b3b94459fc79664d521de3790dd6b0df --- Core/Common/test/Core.Common.Gui.Test/Commands/StorageCommandHandlerTest.cs (.../StorageCommandHandlerTest.cs) (revision d18995d638a6c3f99cb7a8419107bb4148420301) +++ Core/Common/test/Core.Common.Gui.Test/Commands/StorageCommandHandlerTest.cs (.../StorageCommandHandlerTest.cs) (revision 27a3de13b3b94459fc79664d521de3790dd6b0df) @@ -90,7 +90,7 @@ public void SaveProject_SavingProjectThrowsStorageException_AbortSaveAndReturnFalse() { // Setup - string someValidFilePath = TestHelper.GetScratchPadPath(Path.GetRandomFileName()); + string someValidFilePath = TestHelper.GetScratchPadPath(nameof(SaveProject_SavingProjectThrowsStorageException_AbortSaveAndReturnFalse)); using (new FileDisposeHelper(someValidFilePath)) { var projectStub = mocks.Stub(); @@ -136,7 +136,7 @@ public void SaveProject_SavingProjectIsSuccessful_LogSuccessAndReturnTrue() { // Setup - string someValidFilePath = TestHelper.GetScratchPadPath(Path.GetRandomFileName()); + string someValidFilePath = TestHelper.GetScratchPadPath(nameof(SaveProject_SavingProjectIsSuccessful_LogSuccessAndReturnTrue)); using (new FileDisposeHelper(someValidFilePath)) { var projectStub = mocks.Stub(); @@ -474,7 +474,7 @@ // Setup const string projectName = "Project"; string messageBoxText = null; - string someValidFilePath = TestHelper.GetScratchPadPath(Path.GetRandomFileName()); + string someValidFilePath = TestHelper.GetScratchPadPath(nameof(AskConfirmationUnsavedChanges_ProjectSetWithChangeYesPressed_ReturnsTrue)); using (new FileDisposeHelper(someValidFilePath)) { var mainWindowController = mocks.Stub(); @@ -527,7 +527,7 @@ // Setup const string projectName = "Project"; string messageBoxText = null; - string someValidFilePath = TestHelper.GetScratchPadPath(Path.GetRandomFileName()); + string someValidFilePath = TestHelper.GetScratchPadPath(nameof(AskConfirmationUnsavedChanges_ProjectSetWithChangeYesFileDoesNotExist_ReturnsTrue)); var mainWindowController = mocks.Stub(); var projectFactory = mocks.Stub(); Index: Core/Common/test/Core.Common.TestUtil.Test/FileDisposeHelperTest.cs =================================================================== diff -u -r3a1d4488d68236efe6eccbd60be3484735aa689b -r27a3de13b3b94459fc79664d521de3790dd6b0df --- Core/Common/test/Core.Common.TestUtil.Test/FileDisposeHelperTest.cs (.../FileDisposeHelperTest.cs) (revision 3a1d4488d68236efe6eccbd60be3484735aa689b) +++ Core/Common/test/Core.Common.TestUtil.Test/FileDisposeHelperTest.cs (.../FileDisposeHelperTest.cs) (revision 27a3de13b3b94459fc79664d521de3790dd6b0df) @@ -32,7 +32,7 @@ public void Constructor_NotExistingFile_DoesNotThrowException() { // Setup - string filePath = TestHelper.GetScratchPadPath(Path.GetRandomFileName()); + string filePath = TestHelper.GetScratchPadPath(nameof(Constructor_NotExistingFile_DoesNotThrowException)); FileDisposeHelper disposeHelper = null; // Precondition @@ -51,7 +51,7 @@ public void Constructor_ExistingFile_DoesNotThrowException() { // Setup - string filePath = TestHelper.GetScratchPadPath(Path.GetRandomFileName()); + string filePath = TestHelper.GetScratchPadPath(nameof(Constructor_ExistingFile_DoesNotThrowException)); FileDisposeHelper disposeHelper = null; try @@ -77,7 +77,7 @@ public void Constructor_FileDoesNotExist_Createsfile() { // Setup - string filePath = TestHelper.GetScratchPadPath(Path.GetRandomFileName()); + string filePath = TestHelper.GetScratchPadPath(nameof(Constructor_FileDoesNotExist_Createsfile)); try { @@ -118,8 +118,8 @@ // Setup var filePaths = new[] { - TestHelper.GetScratchPadPath(Path.GetRandomFileName()), - TestHelper.GetScratchPadPath(Path.GetRandomFileName()) + TestHelper.GetScratchPadPath($"{nameof(Constructor_MultipleFiles_CreatesFiles)}_0"), + TestHelper.GetScratchPadPath($"{nameof(Constructor_MultipleFiles_CreatesFiles)}_1") }; try @@ -177,7 +177,7 @@ public void LockFiles_ValidFilePath_LocksFile() { // Setup - string filePath = TestHelper.GetScratchPadPath(Path.GetRandomFileName()); + string filePath = TestHelper.GetScratchPadPath(nameof(LockFiles_ValidFilePath_LocksFile)); try { @@ -203,7 +203,7 @@ public void LockFiles_FileAlreadyLocked_ThrowsInvalidOperationException() { // Setup - string filePath = TestHelper.GetScratchPadPath(Path.GetRandomFileName()); + string filePath = TestHelper.GetScratchPadPath(nameof(LockFiles_FileAlreadyLocked_ThrowsInvalidOperationException)); try { @@ -231,7 +231,7 @@ { // Setup string directoryPath = TestHelper.GetScratchPadPath(Path.GetRandomFileName()); - string filePath = Path.Combine(directoryPath, Path.GetRandomFileName()); + string filePath = Path.Combine(directoryPath, nameof(LockFiles_DirectoryAlreadyDeleted_ThrowsInvalidOperationException)); try { @@ -266,7 +266,7 @@ public void LockedFiles_LockFilesCalledAlready_DoesNotThrowException() { // Setup - string filePath = TestHelper.GetScratchPadPath(Path.GetRandomFileName()); + string filePath = TestHelper.GetScratchPadPath(nameof(LockedFiles_LockFilesCalledAlready_DoesNotThrowException)); try { @@ -307,7 +307,7 @@ public void Dispose_ExistingFile_DeletesFile() { // Setup - string filePath = TestHelper.GetScratchPadPath(Path.GetRandomFileName()); + string filePath = TestHelper.GetScratchPadPath(nameof(Dispose_ExistingFile_DeletesFile)); try { @@ -335,8 +335,8 @@ // Setup var filePaths = new[] { - TestHelper.GetScratchPadPath(Path.GetRandomFileName()), - TestHelper.GetScratchPadPath(Path.GetRandomFileName()) + TestHelper.GetScratchPadPath($"{nameof(Dispose_MultipleFiles_DeletesFiles)}_0"), + TestHelper.GetScratchPadPath($"{nameof(Dispose_MultipleFiles_DeletesFiles)}_1") }; try @@ -396,6 +396,32 @@ } } + [Test] + public void Dispose_FileInUse_ThrowsIOException() + { + // Setup + string filePath = TestHelper.GetScratchPadPath(nameof(Dispose_FileInUse_ThrowsIOException)); + + try + { + var disposeHelper = new FileDisposeHelper(filePath); + + using (File.OpenWrite(filePath)) + { + // Call + TestDelegate test = () => disposeHelper.Dispose(); + + // Assert + Assert.Throws(test); + Assert.True(File.Exists(filePath), $"'{filePath}' should still exist."); + } + } + finally + { + File.Delete(filePath); + } + } + private static bool IsFileWritable(string filePath) { try Index: Core/Common/test/Core.Common.TestUtil/FileDisposeHelper.cs =================================================================== diff -u -r701ddc282bbb77d089a68ce276af1a80614435bf -r27a3de13b3b94459fc79664d521de3790dd6b0df --- Core/Common/test/Core.Common.TestUtil/FileDisposeHelper.cs (.../FileDisposeHelper.cs) (revision 701ddc282bbb77d089a68ce276af1a80614435bf) +++ Core/Common/test/Core.Common.TestUtil/FileDisposeHelper.cs (.../FileDisposeHelper.cs) (revision 27a3de13b3b94459fc79664d521de3790dd6b0df) @@ -90,23 +90,15 @@ GC.SuppressFinalize(this); } - private void LockFile(string filePath) - { - try - { - filePathStreams[filePath] = File.OpenWrite(filePath); - } - catch (IOException exception) - { - throw new InvalidOperationException($"Unable to lock '{filePath}'.", exception); - } - } - /// /// Frees the unmanaged resources and deletes the files defined in . /// When is true, the managed resources are freed as well. /// /// Indicates whether the method call comes from the method. + /// Thrown when any of the files in is in use. + /// -or- There is an open handle on the file, + /// and the operating system is Windows XP or earlier. This open handle can result from enumerating + /// directories and files. For more information, see How to: Enumerate Directories and Files. protected virtual void Dispose(bool disposing) { if (disposed) @@ -124,7 +116,7 @@ { DeleteFile(filePathStream.Key); } - catch + catch (ArgumentException) { // ignored } @@ -137,6 +129,18 @@ disposed = true; } + private void LockFile(string filePath) + { + try + { + filePathStreams[filePath] = File.OpenWrite(filePath); + } + catch (IOException exception) + { + throw new InvalidOperationException($"Unable to lock '{filePath}'.", exception); + } + } + /// /// Creates the temporary files. /// @@ -191,9 +195,6 @@ /// Thrown when either: /// /// The specified is invalid (for example, it is on an unmapped drive). - /// The specified is in use. -or-There is an open handle on the file, - /// and the operating system is Windows XP or earlier. This open handle can result from enumerating - /// directories and files. For more information, see How to: Enumerate Directories and Files. /// is in an invalid format. /// The specified exceed the system-defined /// maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and @@ -202,6 +203,9 @@ /// is a directory.-or- specified a read-only file. /// /// + /// Thrown when the specified is in use. -or- There is an open handle on the file, + /// and the operating system is Windows XP or earlier. This open handle can result from enumerating + /// directories and files. For more information, see How to: Enumerate Directories and Files. private static void DeleteFile(string filePath) { if (IOUtils.IsValidFilePath(filePath)) @@ -210,13 +214,9 @@ { File.Delete(filePath); } - catch (Exception e) + catch (Exception e) when (e is DirectoryNotFoundException || e is NotSupportedException || e is UnauthorizedAccessException) { - if (e is DirectoryNotFoundException || e is IOException || e is NotSupportedException || e is UnauthorizedAccessException) - { - throw new ArgumentException(e.Message); - } - throw; + throw new ArgumentException(e.Message); } } } Index: Core/Components/test/Core.Components.DotSpatial.Forms.Test/IO/WmtsConnectionInfoReaderTest.cs =================================================================== diff -u -rd18995d638a6c3f99cb7a8419107bb4148420301 -r27a3de13b3b94459fc79664d521de3790dd6b0df --- Core/Components/test/Core.Components.DotSpatial.Forms.Test/IO/WmtsConnectionInfoReaderTest.cs (.../WmtsConnectionInfoReaderTest.cs) (revision d18995d638a6c3f99cb7a8419107bb4148420301) +++ Core/Components/test/Core.Components.DotSpatial.Forms.Test/IO/WmtsConnectionInfoReaderTest.cs (.../WmtsConnectionInfoReaderTest.cs) (revision 27a3de13b3b94459fc79664d521de3790dd6b0df) @@ -232,7 +232,7 @@ public void ReadWmtsConnectionInfos_FileLocked_ThrowsCriticalFileReadException() { // Setup - string filePath = TestHelper.GetScratchPadPath(Path.GetRandomFileName()); + string filePath = TestHelper.GetScratchPadPath(nameof(ReadWmtsConnectionInfos_FileLocked_ThrowsCriticalFileReadException)); var reader = new WmtsConnectionInfoReader(); using (var fileDisposeHelper = new FileDisposeHelper(filePath)) Index: Core/Components/test/Core.Components.DotSpatial.Forms.Test/IO/WmtsConnectionInfoWriterTest.cs =================================================================== diff -u -rd18995d638a6c3f99cb7a8419107bb4148420301 -r27a3de13b3b94459fc79664d521de3790dd6b0df --- Core/Components/test/Core.Components.DotSpatial.Forms.Test/IO/WmtsConnectionInfoWriterTest.cs (.../WmtsConnectionInfoWriterTest.cs) (revision d18995d638a6c3f99cb7a8419107bb4148420301) +++ Core/Components/test/Core.Components.DotSpatial.Forms.Test/IO/WmtsConnectionInfoWriterTest.cs (.../WmtsConnectionInfoWriterTest.cs) (revision 27a3de13b3b94459fc79664d521de3790dd6b0df) @@ -108,7 +108,7 @@ public void WriteWmtsConnectionInfo_WmtsConnectionInfosNull_ThrowArgumentNullException() { // Setup - string filePath = TestHelper.GetScratchPadPath(Path.GetRandomFileName()); + string filePath = TestHelper.GetScratchPadPath(nameof(WriteWmtsConnectionInfo_WmtsConnectionInfosNull_ThrowArgumentNullException)); var wmtsConfigurationWriter = new WmtsConnectionInfoWriter(filePath); // Call @@ -123,7 +123,7 @@ public void WriteWmtsConnectionInfo_ValidWmtsConnectionInfo_SavesWmtsConnectionInfoToFile() { // Setup - string filePath = TestHelper.GetScratchPadPath(Path.GetRandomFileName()); + string filePath = TestHelper.GetScratchPadPath(nameof(WriteWmtsConnectionInfo_ValidWmtsConnectionInfo_SavesWmtsConnectionInfoToFile)); var wmtsConfigurationWriter = new WmtsConnectionInfoWriter(filePath); var wmtsConnectionInfos = new[] Index: Core/Components/test/Core.Components.Gis.IO.Test/Readers/PointShapeFileReaderTest.cs =================================================================== diff -u -r6928d01beb183acca2937ed5835e951e999be5cb -r27a3de13b3b94459fc79664d521de3790dd6b0df --- Core/Components/test/Core.Components.Gis.IO.Test/Readers/PointShapeFileReaderTest.cs (.../PointShapeFileReaderTest.cs) (revision 6928d01beb183acca2937ed5835e951e999be5cb) +++ Core/Components/test/Core.Components.Gis.IO.Test/Readers/PointShapeFileReaderTest.cs (.../PointShapeFileReaderTest.cs) (revision 27a3de13b3b94459fc79664d521de3790dd6b0df) @@ -124,7 +124,7 @@ public void ParameteredConstructor_ShapeFileIsInUse_ThrowsCriticalFileReadException() { // Setup - string path = TestHelper.GetScratchPadPath(Path.GetRandomFileName()); + string path = TestHelper.GetScratchPadPath($"{nameof(PointShapeFileReaderTest)}.{nameof(ParameteredConstructor_ShapeFileIsInUse_ThrowsCriticalFileReadException)}"); using (var fileDisposeHelper = new FileDisposeHelper(path)) { Index: Core/Components/test/Core.Components.Gis.IO.Test/Readers/PolygonShapeFileReaderTest.cs =================================================================== diff -u -r6928d01beb183acca2937ed5835e951e999be5cb -r27a3de13b3b94459fc79664d521de3790dd6b0df --- Core/Components/test/Core.Components.Gis.IO.Test/Readers/PolygonShapeFileReaderTest.cs (.../PolygonShapeFileReaderTest.cs) (revision 6928d01beb183acca2937ed5835e951e999be5cb) +++ Core/Components/test/Core.Components.Gis.IO.Test/Readers/PolygonShapeFileReaderTest.cs (.../PolygonShapeFileReaderTest.cs) (revision 27a3de13b3b94459fc79664d521de3790dd6b0df) @@ -81,7 +81,7 @@ public void ParameteredConstructor_ShapeFileIsInUse_ThrowsCriticalFileReadException() { // Setup - string path = TestHelper.GetScratchPadPath(Path.GetRandomFileName()); + string path = TestHelper.GetScratchPadPath($"{nameof(PolygonShapeFileReaderTest)}.{nameof(ParameteredConstructor_ShapeFileIsInUse_ThrowsCriticalFileReadException)}"); using (var fileDisposeHelper = new FileDisposeHelper(path)) { Index: Core/Components/test/Core.Components.Gis.IO.Test/Readers/PolylineShapeFileReaderTest.cs =================================================================== diff -u -r6928d01beb183acca2937ed5835e951e999be5cb -r27a3de13b3b94459fc79664d521de3790dd6b0df --- Core/Components/test/Core.Components.Gis.IO.Test/Readers/PolylineShapeFileReaderTest.cs (.../PolylineShapeFileReaderTest.cs) (revision 6928d01beb183acca2937ed5835e951e999be5cb) +++ Core/Components/test/Core.Components.Gis.IO.Test/Readers/PolylineShapeFileReaderTest.cs (.../PolylineShapeFileReaderTest.cs) (revision 27a3de13b3b94459fc79664d521de3790dd6b0df) @@ -75,7 +75,7 @@ public void ParameteredConstructor_ShapeFileIsInUse_ThrowsCriticalFileReadException() { // Setup - string path = TestHelper.GetScratchPadPath(Path.GetRandomFileName()); + string path = TestHelper.GetScratchPadPath($"{nameof(PolylineShapeFileReaderTest)}.{nameof(ParameteredConstructor_ShapeFileIsInUse_ThrowsCriticalFileReadException)}"); using (var fileDisposeHelper = new FileDisposeHelper(path)) { Index: Core/Components/test/Core.Components.Gis.IO.Test/Writers/PointShapeFileWriterTest.cs =================================================================== diff -u -rd18995d638a6c3f99cb7a8419107bb4148420301 -r27a3de13b3b94459fc79664d521de3790dd6b0df --- Core/Components/test/Core.Components.Gis.IO.Test/Writers/PointShapeFileWriterTest.cs (.../PointShapeFileWriterTest.cs) (revision d18995d638a6c3f99cb7a8419107bb4148420301) +++ Core/Components/test/Core.Components.Gis.IO.Test/Writers/PointShapeFileWriterTest.cs (.../PointShapeFileWriterTest.cs) (revision 27a3de13b3b94459fc79664d521de3790dd6b0df) @@ -145,8 +145,7 @@ public void SaveAs_ValidMapPointData_WritesShapeFile() { // Setup - string directoryPath = TestHelper.GetScratchPadPath("SaveAs_ValidMapPointData_WritesShapeFile"); - Directory.CreateDirectory(directoryPath); + string directoryPath = TestHelper.GetScratchPadPath(nameof(SaveAs_ValidMapPointData_WritesShapeFile)); string filePath = Path.Combine(directoryPath, "test.shp"); var baseName = "test"; @@ -159,26 +158,20 @@ mapPointData.Features.First().MetaData[""] = 123; - try + using (new DirectoryDisposeHelper(TestHelper.GetScratchPadPath(), nameof(SaveAs_ValidMapPointData_WritesShapeFile))) + using (var writer = new PointShapeFileWriter()) { - using (var writer = new PointShapeFileWriter()) - { - writer.CopyToFeature(mapPointData); + writer.CopyToFeature(mapPointData); - // Precondition - AssertEssentialShapefileExists(directoryPath, baseName, false); + // Call + writer.SaveAs(filePath); - // Call - writer.SaveAs(filePath); - - // Assert - AssertEssentialShapefileExists(directoryPath, baseName, true); - } + // Assert + string pathName = Path.Combine(directoryPath, baseName); + Assert.IsTrue(File.Exists(pathName + ".shp")); + Assert.IsTrue(File.Exists(pathName + ".shx")); + Assert.IsTrue(File.Exists(pathName + ".dbf")); } - finally - { - Directory.Delete(directoryPath, true); - } } private static MapFeature[] CreateFeatures(double seed) @@ -197,13 +190,5 @@ }) }; } - - private static void AssertEssentialShapefileExists(string directoryPath, string baseName, bool shouldExist) - { - string pathName = Path.Combine(directoryPath, baseName); - Assert.AreEqual(shouldExist, File.Exists(pathName + ".shp")); - Assert.AreEqual(shouldExist, File.Exists(pathName + ".shx")); - Assert.AreEqual(shouldExist, File.Exists(pathName + ".dbf")); - } } } \ No newline at end of file Index: Core/Components/test/Core.Components.Gis.IO.Test/Writers/PolylineShapeFileWriterTest.cs =================================================================== diff -u -rd18995d638a6c3f99cb7a8419107bb4148420301 -r27a3de13b3b94459fc79664d521de3790dd6b0df --- Core/Components/test/Core.Components.Gis.IO.Test/Writers/PolylineShapeFileWriterTest.cs (.../PolylineShapeFileWriterTest.cs) (revision d18995d638a6c3f99cb7a8419107bb4148420301) +++ Core/Components/test/Core.Components.Gis.IO.Test/Writers/PolylineShapeFileWriterTest.cs (.../PolylineShapeFileWriterTest.cs) (revision 27a3de13b3b94459fc79664d521de3790dd6b0df) @@ -144,8 +144,7 @@ public void SaveAs_ValidMapLineData_WritesShapeFile() { // Setup - string directoryPath = TestHelper.GetScratchPadPath("SaveAs_ValidMapLineData_WritesShapeFile"); - Directory.CreateDirectory(directoryPath); + string directoryPath = TestHelper.GetScratchPadPath(nameof(SaveAs_ValidMapLineData_WritesShapeFile)); string filePath = Path.Combine(directoryPath, "test.shp"); var baseName = "test"; @@ -157,27 +156,21 @@ }; mapLineData.Features.First().MetaData[""] = 123; - - try + + using(new DirectoryDisposeHelper(TestHelper.GetScratchPadPath(), nameof(SaveAs_ValidMapLineData_WritesShapeFile))) + using (var writer = new PolylineShapeFileWriter()) { - using (var writer = new PolylineShapeFileWriter()) - { - writer.CopyToFeature(mapLineData); + writer.CopyToFeature(mapLineData); + + // Call + writer.SaveAs(filePath); - // Precondition - AssertEssentialShapefileExists(directoryPath, baseName, false); - - // Call - writer.SaveAs(filePath); - - // Assert - AssertEssentialShapefileExists(directoryPath, baseName, true); - } + // Assert + string pathName = Path.Combine(directoryPath, baseName); + Assert.IsTrue(File.Exists(pathName + ".shp")); + Assert.IsTrue(File.Exists(pathName + ".shx")); + Assert.IsTrue(File.Exists(pathName + ".dbf")); } - finally - { - Directory.Delete(directoryPath, true); - } } private static MapFeature[] CreateFeatures(double seed) @@ -198,13 +191,5 @@ }) }; } - - private static void AssertEssentialShapefileExists(string directoryPath, string baseName, bool shouldExist) - { - string pathName = Path.Combine(directoryPath, baseName); - Assert.AreEqual(shouldExist, File.Exists(pathName + ".shp")); - Assert.AreEqual(shouldExist, File.Exists(pathName + ".shx")); - Assert.AreEqual(shouldExist, File.Exists(pathName + ".dbf")); - } } } \ No newline at end of file Index: Core/Components/test/Core.Components.Gis.IO.Test/Writers/ShapeFileWriterBaseTest.cs =================================================================== diff -u -rd18995d638a6c3f99cb7a8419107bb4148420301 -r27a3de13b3b94459fc79664d521de3790dd6b0df --- Core/Components/test/Core.Components.Gis.IO.Test/Writers/ShapeFileWriterBaseTest.cs (.../ShapeFileWriterBaseTest.cs) (revision d18995d638a6c3f99cb7a8419107bb4148420301) +++ Core/Components/test/Core.Components.Gis.IO.Test/Writers/ShapeFileWriterBaseTest.cs (.../ShapeFileWriterBaseTest.cs) (revision 27a3de13b3b94459fc79664d521de3790dd6b0df) @@ -134,28 +134,22 @@ [Test] public void SaveAs_InvalidDirectoryRights_ThrowCriticalFileWriteException() { - string directoryPath = TestHelper.GetScratchPadPath("SaveAs_InvalidDirectoryRights_ThrowCriticalFileWriteException"); - Directory.CreateDirectory(directoryPath); + string directoryPath = TestHelper.GetScratchPadPath(nameof(SaveAs_InvalidDirectoryRights_ThrowCriticalFileWriteException)); string filePath = Path.Combine(directoryPath, "test.shp"); - - try + + using (var disposeHelper = new DirectoryDisposeHelper(TestHelper.GetScratchPadPath(), nameof(SaveAs_InvalidDirectoryRights_ThrowCriticalFileWriteException))) + using (var writer = new TestShapeFileWriterBase()) { - using (new DirectoryPermissionsRevoker(directoryPath, FileSystemRights.Write)) - using (var writer = new TestShapeFileWriterBase()) - { - // Call - TestDelegate call = () => writer.SaveAs(filePath); + disposeHelper.LockDirectory(FileSystemRights.Write); - // Assert - var expectedMessage = $"Er is een onverwachte fout opgetreden tijdens het schrijven van het bestand '{filePath}'."; - var message = Assert.Throws(call).Message; - Assert.AreEqual(expectedMessage, message); - } + // Call + TestDelegate call = () => writer.SaveAs(filePath); + + // Assert + var expectedMessage = $"Er is een onverwachte fout opgetreden tijdens het schrijven van het bestand '{filePath}'."; + var message = Assert.Throws(call).Message; + Assert.AreEqual(expectedMessage, message); } - finally - { - Directory.Delete(directoryPath, true); - } } private class TestShapeFileWriterBase : ShapeFileWriterBase Index: Migration/Core/test/Migration.Core.Storage.Test/VersionedFileMigratorTest.cs =================================================================== diff -u -rd18995d638a6c3f99cb7a8419107bb4148420301 -r27a3de13b3b94459fc79664d521de3790dd6b0df --- Migration/Core/test/Migration.Core.Storage.Test/VersionedFileMigratorTest.cs (.../VersionedFileMigratorTest.cs) (revision d18995d638a6c3f99cb7a8419107bb4148420301) +++ Migration/Core/test/Migration.Core.Storage.Test/VersionedFileMigratorTest.cs (.../VersionedFileMigratorTest.cs) (revision 27a3de13b3b94459fc79664d521de3790dd6b0df) @@ -328,7 +328,7 @@ const string fromLocation = "fromLocation"; const string toVersion = "toVersion"; - string toLocation = TestHelper.GetScratchPadPath(Path.GetRandomFileName()); + string toLocation = TestHelper.GetScratchPadPath(nameof(Migrate_ValidMigration_CreatesNewVersion)); var mockRepository = new MockRepository(); var comparer = mockRepository.Stub(); @@ -366,7 +366,7 @@ const string fromVersion = "0"; const string toVersion = "2"; - string toLocation = TestHelper.GetScratchPadPath(Path.GetRandomFileName()); + string toLocation = TestHelper.GetScratchPadPath(nameof(Migrate_ValidChainingMigration_CreatesNewVersion)); var mockRepository = new MockRepository(); var versionedFile = mockRepository.Stub(); @@ -406,7 +406,7 @@ const string fromLocation = "fromLocation"; const string toVersion = "toVersion"; - string toLocation = TestHelper.GetScratchPadPath(Path.GetRandomFileName()); + string toLocation = TestHelper.GetScratchPadPath(nameof(Migrate_ValidMigrationFileInUse_ThrowsCriticalMigrationException)); var mockRepository = new MockRepository(); var comparer = mockRepository.Stub(); Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/DikeProfiles/ProfileLocationReaderTest.cs =================================================================== diff -u -r6928d01beb183acca2937ed5835e951e999be5cb -r27a3de13b3b94459fc79664d521de3790dd6b0df --- Ringtoets/Common/test/Ringtoets.Common.IO.Test/DikeProfiles/ProfileLocationReaderTest.cs (.../ProfileLocationReaderTest.cs) (revision 6928d01beb183acca2937ed5835e951e999be5cb) +++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/DikeProfiles/ProfileLocationReaderTest.cs (.../ProfileLocationReaderTest.cs) (revision 27a3de13b3b94459fc79664d521de3790dd6b0df) @@ -163,7 +163,7 @@ public void Constructor_FileInUse_ThrowCriticalFileReadException() { // Setup - string path = TestHelper.GetScratchPadPath(Path.GetRandomFileName()); + string path = TestHelper.GetScratchPadPath($"{nameof(ProfileLocationReaderTest)}.{nameof(Constructor_FileInUse_ThrowCriticalFileReadException)}"); using (var fileDisposeHelper = new FileDisposeHelper(path)) { Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/FailureMechanismSectionReaderTest.cs =================================================================== diff -u -r6928d01beb183acca2937ed5835e951e999be5cb -r27a3de13b3b94459fc79664d521de3790dd6b0df --- Ringtoets/Common/test/Ringtoets.Common.IO.Test/FailureMechanismSectionReaderTest.cs (.../FailureMechanismSectionReaderTest.cs) (revision 6928d01beb183acca2937ed5835e951e999be5cb) +++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/FailureMechanismSectionReaderTest.cs (.../FailureMechanismSectionReaderTest.cs) (revision 27a3de13b3b94459fc79664d521de3790dd6b0df) @@ -321,7 +321,7 @@ public void ReadFailureMechanismSection_FileInUse_ThrowCriticalFileReadException() { // Setup - string path = TestHelper.GetScratchPadPath(Path.GetRandomFileName()); + string path = TestHelper.GetScratchPadPath(nameof(ReadFailureMechanismSection_FileInUse_ThrowCriticalFileReadException)); using (var fileDisposeHelper = new FileDisposeHelper(path)) { Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/ReferenceLines/ReferenceLineReaderTest.cs =================================================================== diff -u -r6928d01beb183acca2937ed5835e951e999be5cb -r27a3de13b3b94459fc79664d521de3790dd6b0df --- Ringtoets/Common/test/Ringtoets.Common.IO.Test/ReferenceLines/ReferenceLineReaderTest.cs (.../ReferenceLineReaderTest.cs) (revision 6928d01beb183acca2937ed5835e951e999be5cb) +++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/ReferenceLines/ReferenceLineReaderTest.cs (.../ReferenceLineReaderTest.cs) (revision 27a3de13b3b94459fc79664d521de3790dd6b0df) @@ -199,7 +199,7 @@ { // Setup var reader = new ReferenceLineReader(); - string path = TestHelper.GetScratchPadPath(Path.GetRandomFileName()); + string path = TestHelper.GetScratchPadPath(nameof(ReadReferenceLine_FileInUse_ThrowCriticalFileReadException)); using (var fileDisposeHelper = new FileDisposeHelper(path)) { Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/Structures/StructureLocationReaderTest.cs =================================================================== diff -u -r6928d01beb183acca2937ed5835e951e999be5cb -r27a3de13b3b94459fc79664d521de3790dd6b0df --- Ringtoets/Common/test/Ringtoets.Common.IO.Test/Structures/StructureLocationReaderTest.cs (.../StructureLocationReaderTest.cs) (revision 6928d01beb183acca2937ed5835e951e999be5cb) +++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/Structures/StructureLocationReaderTest.cs (.../StructureLocationReaderTest.cs) (revision 27a3de13b3b94459fc79664d521de3790dd6b0df) @@ -157,7 +157,7 @@ public void Constructor_FileInUse_ThrowCriticalFileReadException() { // Setup - string path = TestHelper.GetScratchPadPath(Path.GetRandomFileName()); + string path = TestHelper.GetScratchPadPath($"{nameof(StructureLocationReaderTest)}.{nameof(Constructor_FileInUse_ThrowCriticalFileReadException)}"); using (var fileDisposeHelper = new FileDisposeHelper(path)) { Index: Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.IO.Test/DuneLocationsWriterTest.cs =================================================================== diff -u -r6928d01beb183acca2937ed5835e951e999be5cb -r27a3de13b3b94459fc79664d521de3790dd6b0df --- Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.IO.Test/DuneLocationsWriterTest.cs (.../DuneLocationsWriterTest.cs) (revision 6928d01beb183acca2937ed5835e951e999be5cb) +++ Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.IO.Test/DuneLocationsWriterTest.cs (.../DuneLocationsWriterTest.cs) (revision 27a3de13b3b94459fc79664d521de3790dd6b0df) @@ -118,7 +118,7 @@ public void WriteDuneLocations_FileInUse_ThrowCriticalFileWriteException() { // Setup - string path = TestHelper.GetScratchPadPath(Path.GetRandomFileName()); + string path = TestHelper.GetScratchPadPath(nameof(WriteDuneLocations_FileInUse_ThrowCriticalFileWriteException)); using (var fileDisposeHelper = new FileDisposeHelper(path)) { Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Exporters/PipingConfigurationWriterTest.cs =================================================================== diff -u -r6928d01beb183acca2937ed5835e951e999be5cb -r27a3de13b3b94459fc79664d521de3790dd6b0df --- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Exporters/PipingConfigurationWriterTest.cs (.../PipingConfigurationWriterTest.cs) (revision 6928d01beb183acca2937ed5835e951e999be5cb) +++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Exporters/PipingConfigurationWriterTest.cs (.../PipingConfigurationWriterTest.cs) (revision 27a3de13b3b94459fc79664d521de3790dd6b0df) @@ -152,7 +152,7 @@ public void Write_FileInUse_ThrowCriticalFileWriteException() { // Setup - string path = TestHelper.GetScratchPadPath(Path.GetRandomFileName()); + string path = TestHelper.GetScratchPadPath(nameof(Write_FileInUse_ThrowCriticalFileWriteException)); using (var fileDisposeHelper = new FileDisposeHelper(path)) { Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Readers/PipingConfigurationReaderTest.cs =================================================================== diff -u -rb4a35170064dd3e574731a95a860b006cef52cc9 -r27a3de13b3b94459fc79664d521de3790dd6b0df --- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Readers/PipingConfigurationReaderTest.cs (.../PipingConfigurationReaderTest.cs) (revision b4a35170064dd3e574731a95a860b006cef52cc9) +++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Readers/PipingConfigurationReaderTest.cs (.../PipingConfigurationReaderTest.cs) (revision 27a3de13b3b94459fc79664d521de3790dd6b0df) @@ -243,7 +243,7 @@ public void Constructor_FileInUse_ThrowCriticalFileReadException() { // Setup - string path = TestHelper.GetScratchPadPath(Path.GetRandomFileName()); + string path = TestHelper.GetScratchPadPath($"{nameof(PipingConfigurationReaderTest)}.{nameof(Constructor_FileInUse_ThrowCriticalFileReadException)}"); using (var fileDisposeHelper = new FileDisposeHelper(path)) { Index: Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/WaveConditionsWriterTest.cs =================================================================== diff -u -r6928d01beb183acca2937ed5835e951e999be5cb -r27a3de13b3b94459fc79664d521de3790dd6b0df --- Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/WaveConditionsWriterTest.cs (.../WaveConditionsWriterTest.cs) (revision 6928d01beb183acca2937ed5835e951e999be5cb) +++ Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/WaveConditionsWriterTest.cs (.../WaveConditionsWriterTest.cs) (revision 27a3de13b3b94459fc79664d521de3790dd6b0df) @@ -119,7 +119,7 @@ public void WriteWaveConditions_FileInUse_ThrowCriticalFileWriteException() { // Setup - string path = TestHelper.GetScratchPadPath(Path.GetRandomFileName()); + string path = TestHelper.GetScratchPadPath(nameof(WriteWaveConditions_FileInUse_ThrowCriticalFileWriteException)); using (var fileDisposeHelper = new FileDisposeHelper(path)) {