Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/DikeProfiles/ProfileLocationReaderTest.cs =================================================================== diff -u -r7b85dbce8bcc39e824c367468892764778527ce4 -r6928d01beb183acca2937ed5835e951e999be5cb --- Ringtoets/Common/test/Ringtoets.Common.IO.Test/DikeProfiles/ProfileLocationReaderTest.cs (.../ProfileLocationReaderTest.cs) (revision 7b85dbce8bcc39e824c367468892764778527ce4) +++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/DikeProfiles/ProfileLocationReaderTest.cs (.../ProfileLocationReaderTest.cs) (revision 6928d01beb183acca2937ed5835e951e999be5cb) @@ -163,17 +163,17 @@ public void Constructor_FileInUse_ThrowCriticalFileReadException() { // Setup - string validFilePath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Common.IO, - Path.Combine("DikeProfiles", "Voorlanden 12-2.shp")); + string path = TestHelper.GetScratchPadPath(Path.GetRandomFileName()); - using (new FileStream(validFilePath, FileMode.Open)) + using (var fileDisposeHelper = new FileDisposeHelper(path)) { + fileDisposeHelper.LockFiles(); + // Call - TestDelegate call = () => new ProfileLocationReader(validFilePath); + TestDelegate call = () => new ProfileLocationReader(path); // Assert - var expectedMessage = string.Format("Fout bij het lezen van bestand '{0}': het bestand kon niet worden geopend. Mogelijk is het bestand corrupt of in gebruik door een andere applicatie.", - validFilePath); + string expectedMessage = $"Fout bij het lezen van bestand '{path}': het bestand kon niet worden geopend. Mogelijk is het bestand corrupt of in gebruik door een andere applicatie."; var exception = Assert.Throws(call); Assert.AreEqual(expectedMessage, exception.Message); Assert.IsInstanceOf(exception.InnerException);