@@ -73,7 +73,7 @@ public IDirectoryInfo CreateTempSubdirectory(string? prefix = null)
7373 _fileSystem . Path . GetTempPath ( ) ,
7474 ( prefix ?? "" ) + _fileSystem . Path . GetFileNameWithoutExtension (
7575 _fileSystem . Path . GetRandomFileName ( ) ) ) ;
76- Execute . OnMac ( ( ) => localBasePath = "/private" + localBasePath ) ;
76+ _fileSystem . Execute . OnMac ( ( ) => localBasePath = "/private" + localBasePath ) ;
7777 basePath = localBasePath ;
7878 } while ( _fileSystem . Directory . Exists ( basePath ) ) ;
7979
@@ -85,13 +85,13 @@ public IDirectoryInfo CreateTempSubdirectory(string? prefix = null)
8585 /// <inheritdoc cref="IDirectory.Delete(string)" />
8686 public void Delete ( string path )
8787 => _fileSystem . DirectoryInfo
88- . New ( path . EnsureValidFormat ( FileSystem ) )
88+ . New ( path . EnsureValidFormat ( _fileSystem ) )
8989 . Delete ( ) ;
9090
9191 /// <inheritdoc cref="IDirectory.Delete(string, bool)" />
9292 public void Delete ( string path , bool recursive )
9393 => _fileSystem . DirectoryInfo
94- . New ( path . EnsureValidFormat ( FileSystem ) )
94+ . New ( path . EnsureValidFormat ( _fileSystem ) )
9595 . Delete ( recursive ) ;
9696
9797 /// <inheritdoc cref="IDirectory.EnumerateDirectories(string)" />
@@ -199,14 +199,14 @@ public bool Exists([NotNullWhen(true)] string? path)
199199 public DateTime GetCreationTime ( string path )
200200 => _fileSystem . Storage . GetContainer (
201201 _fileSystem . Storage . GetLocation (
202- path . EnsureValidFormat ( FileSystem ) ) )
202+ path . EnsureValidFormat ( _fileSystem ) ) )
203203 . CreationTime . Get ( DateTimeKind . Local ) ;
204204
205205 /// <inheritdoc cref="IDirectory.GetCreationTimeUtc(string)" />
206206 public DateTime GetCreationTimeUtc ( string path )
207207 => _fileSystem . Storage . GetContainer (
208208 _fileSystem . Storage . GetLocation (
209- path . EnsureValidFormat ( FileSystem ) ) )
209+ path . EnsureValidFormat ( _fileSystem ) ) )
210210 . CreationTime . Get ( DateTimeKind . Utc ) ;
211211
212212 /// <inheritdoc cref="IDirectory.GetCurrentDirectory()" />
@@ -290,28 +290,28 @@ public string[] GetFileSystemEntries(string path,
290290 public DateTime GetLastAccessTime ( string path )
291291 => _fileSystem . Storage . GetContainer (
292292 _fileSystem . Storage . GetLocation (
293- path . EnsureValidFormat ( FileSystem ) ) )
293+ path . EnsureValidFormat ( _fileSystem ) ) )
294294 . LastAccessTime . Get ( DateTimeKind . Local ) ;
295295
296296 /// <inheritdoc cref="IDirectory.GetLastAccessTimeUtc(string)" />
297297 public DateTime GetLastAccessTimeUtc ( string path )
298298 => _fileSystem . Storage . GetContainer (
299299 _fileSystem . Storage . GetLocation (
300- path . EnsureValidFormat ( FileSystem ) ) )
300+ path . EnsureValidFormat ( _fileSystem ) ) )
301301 . LastAccessTime . Get ( DateTimeKind . Utc ) ;
302302
303303 /// <inheritdoc cref="IDirectory.GetLastWriteTime(string)" />
304304 public DateTime GetLastWriteTime ( string path )
305305 => _fileSystem . Storage . GetContainer (
306306 _fileSystem . Storage . GetLocation (
307- path . EnsureValidFormat ( FileSystem ) ) )
307+ path . EnsureValidFormat ( _fileSystem ) ) )
308308 . LastWriteTime . Get ( DateTimeKind . Local ) ;
309309
310310 /// <inheritdoc cref="IDirectory.GetLastWriteTimeUtc(string)" />
311311 public DateTime GetLastWriteTimeUtc ( string path )
312312 => _fileSystem . Storage . GetContainer (
313313 _fileSystem . Storage . GetLocation (
314- path . EnsureValidFormat ( FileSystem ) ) )
314+ path . EnsureValidFormat ( _fileSystem ) ) )
315315 . LastWriteTime . Get ( DateTimeKind . Utc ) ;
316316
317317 /// <inheritdoc cref="IDirectory.GetLogicalDrives()" />
@@ -346,7 +346,7 @@ public void Move(string sourceDirName, string destDirName)
346346 when ( ex . HResult != - 2147024773 )
347347 {
348348 throw ExceptionFactory . FileNameCannotBeResolved ( linkPath ,
349- Execute . IsWindows ? - 2147022975 : - 2146232800 ) ;
349+ _fileSystem . Execute . IsWindows ? - 2147022975 : - 2146232800 ) ;
350350 }
351351 }
352352#endif
@@ -402,30 +402,30 @@ public void SetLastWriteTimeUtc(string path, DateTime lastWriteTimeUtc)
402402 #endregion
403403
404404 private IDirectoryInfo LoadDirectoryInfoOrThrowNotFoundException (
405- string path , Action < IFileSystem , string > onMissingCallback )
405+ string path , Action < MockFileSystem , string > onMissingCallback )
406406 {
407407 IDirectoryInfo directoryInfo =
408- _fileSystem . DirectoryInfo . New ( path . EnsureValidFormat ( FileSystem ) ) ;
408+ _fileSystem . DirectoryInfo . New ( path . EnsureValidFormat ( _fileSystem ) ) ;
409409 if ( ! directoryInfo . Exists )
410410 {
411- onMissingCallback . Invoke ( FileSystem , path ) ;
411+ onMissingCallback . Invoke ( _fileSystem , path ) ;
412412 }
413413
414414 return directoryInfo ;
415415 }
416416
417- private static void ThrowMissingFileCreatedTimeException ( IFileSystem fileSystem , string path )
417+ private static void ThrowMissingFileCreatedTimeException ( MockFileSystem fileSystem , string path )
418418 {
419419#if NET7_0_OR_GREATER
420- Execute . OnMac (
420+ fileSystem . Execute . OnMac (
421421 ( ) =>
422422 throw ExceptionFactory . DirectoryNotFound (
423423 fileSystem . Path . GetFullPath ( path ) ) ,
424424 ( ) =>
425425 throw ExceptionFactory . FileNotFound (
426426 fileSystem . Path . GetFullPath ( path ) ) ) ;
427427#else
428- Execute . OnWindows (
428+ fileSystem . Execute . OnWindows (
429429 ( ) =>
430430 throw ExceptionFactory . FileNotFound (
431431 fileSystem . Path . GetFullPath ( path ) ) ,
@@ -435,14 +435,14 @@ private static void ThrowMissingFileCreatedTimeException(IFileSystem fileSystem,
435435#endif
436436 }
437437
438- private static void ThrowMissingFileLastAccessOrLastWriteTimeException ( IFileSystem fileSystem ,
438+ private static void ThrowMissingFileLastAccessOrLastWriteTimeException ( MockFileSystem fileSystem ,
439439 string path )
440440 {
441441#if NET7_0_OR_GREATER
442442 throw ExceptionFactory . FileNotFound (
443443 fileSystem . Path . GetFullPath ( path ) ) ;
444444#else
445- Execute . OnWindows (
445+ fileSystem . Execute . OnWindows (
446446 ( ) =>
447447 throw ExceptionFactory . FileNotFound (
448448 fileSystem . Path . GetFullPath ( path ) ) ,
@@ -458,8 +458,8 @@ private IEnumerable<string> EnumerateInternal(FileSystemTypes fileSystemTypes,
458458 EnumerationOptions enumerationOptions )
459459 {
460460 StorageExtensions . AdjustedLocation adjustedLocation = _fileSystem . Storage
461- . AdjustLocationFromSearchPattern (
462- path . EnsureValidFormat ( FileSystem ) ,
461+ . AdjustLocationFromSearchPattern ( _fileSystem ,
462+ path . EnsureValidFormat ( _fileSystem ) ,
463463 searchPattern ) ;
464464 return _fileSystem . Storage . EnumerateLocations (
465465 adjustedLocation . Location ,
0 commit comments