@@ -503,7 +503,7 @@ public override void Move(string sourceDirName, string destDirName)
503503 var fullSourcePath = mockFileDataAccessor . Path . GetFullPath ( sourceDirName ) . TrimSlashes ( ) ;
504504 var fullDestPath = mockFileDataAccessor . Path . GetFullPath ( destDirName ) . TrimSlashes ( ) ;
505505
506- if ( mockFileDataAccessor . StringOperations . Equals ( fullSourcePath , fullDestPath ) )
506+ if ( string . Equals ( fullSourcePath , fullDestPath , StringComparison . Ordinal ) )
507507 {
508508 throw new IOException ( "Source and destination path must be different." ) ;
509509 }
@@ -537,9 +537,13 @@ public override void Move(string sourceDirName, string destDirName)
537537
538538 if ( mockFileDataAccessor . Directory . Exists ( fullDestPath ) || mockFileDataAccessor . File . Exists ( fullDestPath ) )
539539 {
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+ }
541546 }
542-
543547 mockFileDataAccessor . MoveDirectory ( fullSourcePath , fullDestPath ) ;
544548 }
545549
@@ -653,15 +657,15 @@ public override IEnumerable<string> EnumerateDirectories(string path, string sea
653657 . Where ( p => ! mockFileDataAccessor . StringOperations . Equals ( p , path ) )
654658 . Select ( p => FixPrefix ( p , originalPath ) ) ;
655659 }
656-
660+
657661 private string FixPrefix ( string path , string originalPath )
658662 {
659663 var normalizedOriginalPath = mockFileDataAccessor . Path . GetFullPath ( originalPath ) ;
660664 var pathWithoutOriginalPath = path . Substring ( normalizedOriginalPath . Length )
661665 . TrimStart ( mockFileDataAccessor . Path . DirectorySeparatorChar ) ;
662666 return mockFileDataAccessor . Path . Combine ( originalPath , pathWithoutOriginalPath ) ;
663667 }
664-
668+
665669#if FEATURE_ENUMERATION_OPTIONS
666670 /// <inheritdoc />
667671 public override IEnumerable < string > EnumerateDirectories ( string path , string searchPattern , EnumerationOptions enumerationOptions )
0 commit comments