Skip to content

Commit 880a334

Browse files
erenesfgreinacher
authored andcommitted
Moved IOException to the CommonExceptions class
1 parent 3d399b0 commit 880a334

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

System.IO.Abstractions.TestingHelpers/CommonExceptions.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,8 @@ public static ArgumentException IllegalCharactersInPath(string paramName = null)
5454

5555
public static Exception InvalidUncPath(string paramName) =>
5656
new ArgumentException(@"The UNC path should be of the form \\server\share.", paramName);
57+
58+
public static IOException ProcessCannotAccessFileInUse() =>
59+
new IOException(StringResources.Manager.GetString("PROCESS_CANNOT_ACCESS_FILE_IN_USE"));
5760
}
5861
}

System.IO.Abstractions.TestingHelpers/MockFile.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ public override void Move(string sourceFileName, string destFileName)
363363
}
364364
if (!sourceFile.AllowedFileShare.HasFlag(FileShare.Delete))
365365
{
366-
throw new IOException("The process cannot access the file because it is being used by another process.");
366+
throw CommonExceptions.ProcessCannotAccessFileInUse();
367367
}
368368
VerifyDirectoryExists(destFileName);
369369

System.IO.Abstractions.TestingHelpers/Properties/Resources.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,4 +147,7 @@
147147
<data name="FILE_SYSTEM_WATCHER_NOT_IMPLEMENTED_EXCEPTION" xml:space="preserve">
148148
<value>MockFileSystem does not have a built-in FileSystemWatcher implementation. You must provide your own mock or implementation of IFileSystemWatcherFactory and assign it to MockFileSystem.FileSystemWatcher.</value>
149149
</data>
150+
<data name="PROCESS_CANNOT_ACCESS_FILE_IN_USE" xml:space="preserve">
151+
<value>The process cannot access the file because it is being used by another process.</value>
152+
</data>
150153
</root>

0 commit comments

Comments
 (0)