|
|
@ -49,6 +49,10 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
|
|
|
|
Mocker.GetMock<SeriesProvider>()
|
|
|
|
Mocker.GetMock<SeriesProvider>()
|
|
|
|
.Setup(c => c.FindSeries(It.IsAny<string>()))
|
|
|
|
.Setup(c => c.FindSeries(It.IsAny<string>()))
|
|
|
|
.Returns(fakeSeries);
|
|
|
|
.Returns(fakeSeries);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<DiskProvider>()
|
|
|
|
|
|
|
|
.Setup(c => c.FolderExists(fakeSeries.Path))
|
|
|
|
|
|
|
|
.Returns(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void WithImportableFiles()
|
|
|
|
private void WithImportableFiles()
|
|
|
@ -295,6 +299,7 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
|
|
|
|
Mocker.GetMock<DiskScanProvider>().Setup(s => s.MoveEpisodeFile(It.IsAny<EpisodeFile>(), true)).Returns(new EpisodeFile());
|
|
|
|
Mocker.GetMock<DiskScanProvider>().Setup(s => s.MoveEpisodeFile(It.IsAny<EpisodeFile>(), true)).Returns(new EpisodeFile());
|
|
|
|
Mocker.GetMock<DiskProvider>().Setup(s => s.GetDirectorySize(droppedFolder.FullName)).Returns(Constants.IgnoreFileSize - 1.Megabytes());
|
|
|
|
Mocker.GetMock<DiskProvider>().Setup(s => s.GetDirectorySize(droppedFolder.FullName)).Returns(Constants.IgnoreFileSize - 1.Megabytes());
|
|
|
|
Mocker.GetMock<DiskProvider>().Setup(s => s.DeleteFolder(droppedFolder.FullName, true));
|
|
|
|
Mocker.GetMock<DiskProvider>().Setup(s => s.DeleteFolder(droppedFolder.FullName, true));
|
|
|
|
|
|
|
|
Mocker.GetMock<DiskProvider>().Setup(s => s.FolderExists(fakeSeries.Path)).Returns(true);
|
|
|
|
Mocker.GetMock<MetadataProvider>().Setup(s => s.CreateForEpisodeFiles(It.IsAny<List<EpisodeFile>>()));
|
|
|
|
Mocker.GetMock<MetadataProvider>().Setup(s => s.CreateForEpisodeFiles(It.IsAny<List<EpisodeFile>>()));
|
|
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
//Act
|
|
|
@ -316,6 +321,7 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
|
|
|
|
.Build().ToList();
|
|
|
|
.Build().ToList();
|
|
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<SeriesProvider>().Setup(s => s.FindSeries(It.IsAny<string>())).Returns(fakeSeries);
|
|
|
|
Mocker.GetMock<SeriesProvider>().Setup(s => s.FindSeries(It.IsAny<string>())).Returns(fakeSeries);
|
|
|
|
|
|
|
|
Mocker.GetMock<DiskProvider>().Setup(s => s.FolderExists(fakeSeries.Path)).Returns(true);
|
|
|
|
Mocker.GetMock<DiskScanProvider>().Setup(s => s.Scan(fakeSeries, droppedFolder.FullName)).Returns(fakeEpisodeFiles);
|
|
|
|
Mocker.GetMock<DiskScanProvider>().Setup(s => s.Scan(fakeSeries, droppedFolder.FullName)).Returns(fakeEpisodeFiles);
|
|
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
//Act
|
|
|
@ -345,6 +351,10 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
|
|
|
|
.Setup(s => s.GetDirectorySize(downloadName.FullName))
|
|
|
|
.Setup(s => s.GetDirectorySize(downloadName.FullName))
|
|
|
|
.Returns(10);
|
|
|
|
.Returns(10);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<DiskProvider>()
|
|
|
|
|
|
|
|
.Setup(s => s.FolderExists(series.Path))
|
|
|
|
|
|
|
|
.Returns(true);
|
|
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<DiskProvider>()
|
|
|
|
Mocker.GetMock<DiskProvider>()
|
|
|
|
.Setup(s => s.FreeDiskSpace(new DirectoryInfo(series.Path)))
|
|
|
|
.Setup(s => s.FreeDiskSpace(new DirectoryInfo(series.Path)))
|
|
|
|
.Returns(9);
|
|
|
|
.Returns(9);
|
|
|
@ -407,5 +417,22 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
|
|
|
|
//Assert
|
|
|
|
//Assert
|
|
|
|
Mocker.GetMock<DiskScanProvider>().Verify(c => c.Scan(fakeSeries, downloadName.FullName), Times.Once());
|
|
|
|
Mocker.GetMock<DiskScanProvider>().Verify(c => c.Scan(fakeSeries, downloadName.FullName), Times.Once());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
|
|
|
public void should_return_if_series_path_does_not_exist()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var downloadName = new DirectoryInfo(@"C:\Test\Drop\30.Rock.S01E01.Pilot");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
WithValidSeries();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<DiskProvider>()
|
|
|
|
|
|
|
|
.Setup(s => s.FolderExists(fakeSeries.Path))
|
|
|
|
|
|
|
|
.Returns(false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Mocker.Resolve<PostDownloadProvider>().ProcessDownload(downloadName);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<DiskProvider>().Verify(c => c.GetDirectorySize(It.IsAny<String>()), Times.Never());
|
|
|
|
|
|
|
|
ExceptionVerification.ExpectedWarns(1);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|