Skip import when when folder is in use

Fixed: Skip post-processing when folder is in use or series path does
not exist on disk
This commit is contained in:
Mark McDowall 2012-10-20 01:01:47 -07:00
commit 5cc2810f77
4 changed files with 84 additions and 8 deletions

View file

@ -227,14 +227,6 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
WithValidSeries();
Mocker.GetMock<DiskProvider>()
.Setup(s => s.GetDirectorySize(downloadName))
.Returns(10);
Mocker.GetMock<DiskProvider>()
.Setup(s => s.FreeDiskSpace(It.IsAny<DirectoryInfo>()))
.Returns(10);
Mocker.GetMock<DiskProvider>()
.Setup(s => s.FolderExists(fakeSeries.Path))
.Returns(false);
@ -246,5 +238,24 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
//Assert
ExceptionVerification.ExpectedWarns(1);
}
[Test]
public void should_skip_if_file_is_in_use_by_another_process()
{
var downloadName = @"C:\Test\Drop\30.Rock.S01E01.Pilot.mkv";
WithValidSeries();
Mocker.GetMock<DiskProvider>()
.Setup(s => s.IsFileLocked(It.Is<FileInfo>(f => f.FullName == downloadName)))
.Returns(true);
//Act
Mocker.Resolve<PostDownloadProvider>().ProcessVideoFile(downloadName);
//Assert
Mocker.GetMock<DiskScanProvider>().Verify(c => c.ImportFile(fakeSeries, downloadName), Times.Never());
}
}
}