@@ -503,7 +503,7 @@ public override void Move(string sourceDirName, string destDirName)
503
503
var fullSourcePath = mockFileDataAccessor . Path . GetFullPath ( sourceDirName ) . TrimSlashes ( ) ;
504
504
var fullDestPath = mockFileDataAccessor . Path . GetFullPath ( destDirName ) . TrimSlashes ( ) ;
505
505
506
- if ( mockFileDataAccessor . StringOperations . Equals ( fullSourcePath , fullDestPath ) )
506
+ if ( string . Equals ( fullSourcePath , fullDestPath , StringComparison . Ordinal ) )
507
507
{
508
508
throw new IOException ( "Source and destination path must be different." ) ;
509
509
}
@@ -537,9 +537,13 @@ public override void Move(string sourceDirName, string destDirName)
537
537
538
538
if ( mockFileDataAccessor . Directory . Exists ( fullDestPath ) || mockFileDataAccessor . File . Exists ( fullDestPath ) )
539
539
{
540
- throw CommonExceptions . CannotCreateBecauseSameNameAlreadyExists ( fullDestPath ) ;
540
+ // In Windows, file/dir names are case sensetive, C:\\temp\\src and C:\\temp\\SRC and treated different
541
+ if ( XFS . IsUnixPlatform ( ) ||
542
+ ! string . Equals ( fullSourcePath , fullDestPath , StringComparison . OrdinalIgnoreCase ) )
543
+ {
544
+ throw CommonExceptions . CannotCreateBecauseSameNameAlreadyExists ( fullDestPath ) ;
545
+ }
541
546
}
542
-
543
547
mockFileDataAccessor . MoveDirectory ( fullSourcePath , fullDestPath ) ;
544
548
}
545
549
@@ -653,15 +657,15 @@ public override IEnumerable<string> EnumerateDirectories(string path, string sea
653
657
. Where ( p => ! mockFileDataAccessor . StringOperations . Equals ( p , path ) )
654
658
. Select ( p => FixPrefix ( p , originalPath ) ) ;
655
659
}
656
-
660
+
657
661
private string FixPrefix ( string path , string originalPath )
658
662
{
659
663
var normalizedOriginalPath = mockFileDataAccessor . Path . GetFullPath ( originalPath ) ;
660
664
var pathWithoutOriginalPath = path . Substring ( normalizedOriginalPath . Length )
661
665
. TrimStart ( mockFileDataAccessor . Path . DirectorySeparatorChar ) ;
662
666
return mockFileDataAccessor . Path . Combine ( originalPath , pathWithoutOriginalPath ) ;
663
667
}
664
-
668
+
665
669
#if FEATURE_ENUMERATION_OPTIONS
666
670
/// <inheritdoc />
667
671
public override IEnumerable < string > EnumerateDirectories ( string path , string searchPattern , EnumerationOptions enumerationOptions )
0 commit comments