More skip import

This commit is contained in:
Mark McDowall 2012-10-19 23:46:36 -07:00
parent b5e196fcef
commit 5014745f88
2 changed files with 43 additions and 1 deletions

View File

@ -72,10 +72,13 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
.Setup(c => c.GetDirectorySize(It.IsAny<String>())) .Setup(c => c.GetDirectorySize(It.IsAny<String>()))
.Returns(10); .Returns(10);
Mocker.GetMock<DiskProvider>()
.Setup(c => c.FolderExists(It.IsAny<String>()))
.Returns(true);
//Act //Act
Mocker.Resolve<PostDownloadProvider>().ProcessDropFolder(@"C:\drop\"); Mocker.Resolve<PostDownloadProvider>().ProcessDropFolder(@"C:\drop\");
//Assert //Assert
Mocker.GetMock<DiskScanProvider>().Verify(c => c.Scan(It.IsAny<Series>(), subFolders[0]), Times.Once()); Mocker.GetMock<DiskScanProvider>().Verify(c => c.Scan(It.IsAny<Series>(), subFolders[0]), Times.Once());
Mocker.GetMock<DiskScanProvider>().Verify(c => c.Scan(It.IsAny<Series>(), subFolders[1]), Times.Never()); Mocker.GetMock<DiskScanProvider>().Verify(c => c.Scan(It.IsAny<Series>(), subFolders[1]), Times.Never());
@ -112,6 +115,10 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
.Setup(c => c.GetDirectorySize(It.IsAny<String>())) .Setup(c => c.GetDirectorySize(It.IsAny<String>()))
.Returns(10); .Returns(10);
Mocker.GetMock<DiskProvider>()
.Setup(c => c.FolderExists(It.IsAny<String>()))
.Returns(true);
//Act //Act
Mocker.Resolve<PostDownloadProvider>().ProcessDropFolder(@"C:\drop\"); Mocker.Resolve<PostDownloadProvider>().ProcessDropFolder(@"C:\drop\");

View File

@ -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(s => s.FolderExists(fakeSeries.Path))
.Returns(true);
} }
private void WithImportableFiles() private void WithImportableFiles()
@ -156,6 +160,10 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
.Setup(s => s.FreeDiskSpace(new DirectoryInfo(series.Path))) .Setup(s => s.FreeDiskSpace(new DirectoryInfo(series.Path)))
.Returns(9); .Returns(9);
Mocker.GetMock<DiskProvider>()
.Setup(s => s.FolderExists(series.Path))
.Returns(true);
//Act //Act
Mocker.Resolve<PostDownloadProvider>().ProcessVideoFile(downloadName); Mocker.Resolve<PostDownloadProvider>().ProcessVideoFile(downloadName);
@ -211,5 +219,32 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
//Assert //Assert
Mocker.GetMock<DiskScanProvider>().Verify(c => c.ImportFile(fakeSeries, downloadName), Times.Once()); Mocker.GetMock<DiskScanProvider>().Verify(c => c.ImportFile(fakeSeries, downloadName), Times.Once());
} }
[Test]
public void should_return_if_series_Path_doesnt_exist()
{
var downloadName = @"C:\Test\Drop\30.Rock.S01E01.Pilot.mkv";
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);
//Act
Mocker.Resolve<PostDownloadProvider>().ProcessVideoFile(downloadName);
//Assert
ExceptionVerification.ExpectedWarns(1);
}
} }
} }