diff --git a/src/TestableIO.System.IO.Abstractions.TestingHelpers/MockDirectory.cs b/src/TestableIO.System.IO.Abstractions.TestingHelpers/MockDirectory.cs index 5b9e7968b..69a02947f 100644 --- a/src/TestableIO.System.IO.Abstractions.TestingHelpers/MockDirectory.cs +++ b/src/TestableIO.System.IO.Abstractions.TestingHelpers/MockDirectory.cs @@ -502,12 +502,7 @@ public override void Move(string sourceDirName, string destDirName) { var fullSourcePath = mockFileDataAccessor.Path.GetFullPath(sourceDirName).TrimSlashes(); var fullDestPath = mockFileDataAccessor.Path.GetFullPath(destDirName).TrimSlashes(); - - if (mockFileDataAccessor.StringOperations.Equals(fullSourcePath, fullDestPath)) - { - throw new IOException("Source and destination path must be different."); - } - + //if we're moving a file, not a directory, call the appropriate file moving function. var fileData = mockFileDataAccessor.GetFile(fullSourcePath); if (fileData?.Attributes.HasFlag(FileAttributes.Directory) == false) @@ -534,12 +529,7 @@ public override void Move(string sourceDirName, string destDirName) { throw CommonExceptions.CouldNotFindPartOfPath(destDirName); } - - if (mockFileDataAccessor.Directory.Exists(fullDestPath) || mockFileDataAccessor.File.Exists(fullDestPath)) - { - throw CommonExceptions.CannotCreateBecauseSameNameAlreadyExists(fullDestPath); - } - + mockFileDataAccessor.MoveDirectory(fullSourcePath, fullDestPath); }