We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent cbdd8a6 commit ac4ebd1Copy full SHA for ac4ebd1
src/TestableIO.System.IO.Abstractions.Wrappers/DirectoryWrapper.cs
@@ -215,6 +215,17 @@ public override IDirectoryInfo GetParent(string path)
215
/// <inheritdoc />
216
public override void Move(string sourceDirName, string destDirName)
217
{
218
+ var fullSourcePath = Path.GetFullPath(sourceDirName);
219
+ var fullDestPath = Path.GetFullPath(destDirName);
220
+
221
+ if (fullDestPath.Equals(fullDestPath))
222
+ {
223
+ throw new IOException("Source and destination path must be different.");
224
+ }
225
+ else if (Directory.Exists(fullDestPath) || File.Exists(fullDestPath))
226
227
+ throw new IOException("Destination path already exists.");
228
229
Directory.Move(sourceDirName, destDirName);
230
}
231
0 commit comments