File tree Expand file tree Collapse file tree 4 files changed +9
-4
lines changed
System.IO.Abstractions.TestingHelpers Expand file tree Collapse file tree 4 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -55,7 +55,9 @@ public static ArgumentException IllegalCharactersInPath(string paramName = null)
5555 public static Exception InvalidUncPath ( string paramName ) =>
5656 new ArgumentException ( @"The UNC path should be of the form \\server\share." , paramName ) ;
5757
58- public static IOException ProcessCannotAccessFileInUse ( ) =>
59- new IOException ( StringResources . Manager . GetString ( "PROCESS_CANNOT_ACCESS_FILE_IN_USE" ) ) ;
58+ public static IOException ProcessCannotAccessFileInUse ( string paramName = null ) =>
59+ paramName != null
60+ ? new IOException ( string . Format ( StringResources . Manager . GetString ( "PROCESS_CANNOT_ACCESS_FILE_IN_USE_WITH_FILENAME" ) , paramName ) )
61+ : new IOException ( StringResources . Manager . GetString ( "PROCESS_CANNOT_ACCESS_FILE_IN_USE" ) ) ;
6062 }
6163}
Original file line number Diff line number Diff line change @@ -180,7 +180,7 @@ public override void Delete(string path)
180180 var file = mockFileDataAccessor . GetFile ( path ) ;
181181 if ( file != null && ! file . AllowedFileShare . HasFlag ( FileShare . Delete ) )
182182 {
183- throw new IOException ( $ "The process cannot access the file ' { path } ' because it is being used by another process." ) ;
183+ throw CommonExceptions . ProcessCannotAccessFileInUse ( path ) ;
184184 }
185185
186186 mockFileDataAccessor . RemoveFile ( path ) ;
Original file line number Diff line number Diff line change @@ -177,7 +177,7 @@ public FileSecurity AccessControl
177177 internal void CheckFileAccess ( string path , FileAccess access )
178178 {
179179 if ( ! AllowedFileShare . HasFlag ( ( FileShare ) access ) )
180- throw new IOException ( $ "The process cannot access the file ' { path } ' because it is being used by another process." ) ;
180+ throw CommonExceptions . ProcessCannotAccessFileInUse ( path ) ;
181181 }
182182 }
183183}
Original file line number Diff line number Diff line change 150150 <data name =" PROCESS_CANNOT_ACCESS_FILE_IN_USE" xml : space =" preserve" >
151151 <value >The process cannot access the file because it is being used by another process.</value >
152152 </data >
153+ <data name =" PROCESS_CANNOT_ACCESS_FILE_IN_USE_WITH_FILENAME" xml : space =" preserve" >
154+ <value >The process cannot access the file '{0}' because it is being used by another process.</value >
155+ </data >
153156</root >
You can’t perform that action at this time.
0 commit comments