Fixed: NET Core doing copy/delete instead of rename

This commit is contained in:
ta264
2019-12-23 21:50:52 +00:00
parent 38b6bb3952
commit 10fc0b071f
3 changed files with 31 additions and 5 deletions
@@ -80,6 +80,23 @@ namespace NzbDrone.Common.Test.DiskTests
File.Exists(destination).Should().BeTrue();
}
[Test]
[Retry(5)]
public void MoveFile_should_not_overwrite_existing_file()
{
var source1 = GetTempFilePath();
var source2 = GetTempFilePath();
var destination = GetTempFilePath();
File.WriteAllText(source1, "SourceFile1");
File.WriteAllText(source2, "SourceFile2");
Subject.MoveFile(source1, destination);
Assert.Throws<IOException>(() => Subject.MoveFile(source2, destination, false));
File.ReadAllText(destination).Should().Be("SourceFile1");
}
[Test]
public void MoveFile_should_not_move_overwrite_itself()
{