|
|
@ -198,10 +198,6 @@ namespace NzbDrone.Core.Test
|
|
|
|
ExceptionVerification.ExcpectedErrors(1);
|
|
|
|
ExceptionVerification.ExcpectedErrors(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
[Test]
|
|
|
|
public void start_should_search_all_providers()
|
|
|
|
public void start_should_search_all_providers()
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -233,6 +229,10 @@ namespace NzbDrone.Core.Test
|
|
|
|
.Setup(c => c.GetEnabledIndexers())
|
|
|
|
.Setup(c => c.GetEnabledIndexers())
|
|
|
|
.Returns(indexers);
|
|
|
|
.Returns(indexers);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mocker.GetMock<SeriesProvider>()
|
|
|
|
|
|
|
|
.Setup(c => c.GetSeries(It.IsAny<int>()))
|
|
|
|
|
|
|
|
.Returns(episode.Series);
|
|
|
|
|
|
|
|
|
|
|
|
mocker.GetMock<InventoryProvider>()
|
|
|
|
mocker.GetMock<InventoryProvider>()
|
|
|
|
.Setup(c => c.IsQualityNeeded(It.IsAny<EpisodeParseResult>())).Returns(false);
|
|
|
|
.Setup(c => c.IsQualityNeeded(It.IsAny<EpisodeParseResult>())).Returns(false);
|
|
|
|
|
|
|
|
|
|
|
@ -273,7 +273,6 @@ namespace NzbDrone.Core.Test
|
|
|
|
indexer1.Setup(c => c.FetchEpisode("The Daily Show", episode.SeasonNumber, episode.EpisodeNumber))
|
|
|
|
indexer1.Setup(c => c.FetchEpisode("The Daily Show", episode.SeasonNumber, episode.EpisodeNumber))
|
|
|
|
.Returns(parseResults).Verifiable();
|
|
|
|
.Returns(parseResults).Verifiable();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var indexer2 = new Mock<IndexerBase>();
|
|
|
|
var indexer2 = new Mock<IndexerBase>();
|
|
|
|
indexer2.Setup(c => c.FetchEpisode("The Daily Show", episode.SeasonNumber, episode.EpisodeNumber))
|
|
|
|
indexer2.Setup(c => c.FetchEpisode("The Daily Show", episode.SeasonNumber, episode.EpisodeNumber))
|
|
|
|
.Returns(parseResults).Verifiable();
|
|
|
|
.Returns(parseResults).Verifiable();
|
|
|
@ -284,6 +283,10 @@ namespace NzbDrone.Core.Test
|
|
|
|
.Setup(c => c.GetEnabledIndexers())
|
|
|
|
.Setup(c => c.GetEnabledIndexers())
|
|
|
|
.Returns(indexers);
|
|
|
|
.Returns(indexers);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mocker.GetMock<SeriesProvider>()
|
|
|
|
|
|
|
|
.Setup(c => c.GetSeries(It.IsAny<int>()))
|
|
|
|
|
|
|
|
.Returns(episode.Series);
|
|
|
|
|
|
|
|
|
|
|
|
mocker.GetMock<InventoryProvider>()
|
|
|
|
mocker.GetMock<InventoryProvider>()
|
|
|
|
.Setup(c => c.IsQualityNeeded(It.IsAny<EpisodeParseResult>())).Returns(false);
|
|
|
|
.Setup(c => c.IsQualityNeeded(It.IsAny<EpisodeParseResult>())).Returns(false);
|
|
|
|
|
|
|
|
|
|
|
@ -303,7 +306,6 @@ namespace NzbDrone.Core.Test
|
|
|
|
indexer2.VerifyAll();
|
|
|
|
indexer2.VerifyAll();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
[Test]
|
|
|
|
public void start_failed_indexer_should_not_break_job()
|
|
|
|
public void start_failed_indexer_should_not_break_job()
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -341,6 +343,10 @@ namespace NzbDrone.Core.Test
|
|
|
|
.Setup(c => c.GetEnabledIndexers())
|
|
|
|
.Setup(c => c.GetEnabledIndexers())
|
|
|
|
.Returns(indexers);
|
|
|
|
.Returns(indexers);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mocker.GetMock<SeriesProvider>()
|
|
|
|
|
|
|
|
.Setup(c => c.GetSeries(It.IsAny<int>()))
|
|
|
|
|
|
|
|
.Returns(episode.Series);
|
|
|
|
|
|
|
|
|
|
|
|
mocker.GetMock<InventoryProvider>()
|
|
|
|
mocker.GetMock<InventoryProvider>()
|
|
|
|
.Setup(c => c.IsQualityNeeded(It.IsAny<EpisodeParseResult>())).Returns(false);
|
|
|
|
.Setup(c => c.IsQualityNeeded(It.IsAny<EpisodeParseResult>())).Returns(false);
|
|
|
|
|
|
|
|
|
|
|
@ -363,7 +369,6 @@ namespace NzbDrone.Core.Test
|
|
|
|
indexer3.VerifyAll();
|
|
|
|
indexer3.VerifyAll();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
[Test]
|
|
|
|
public void start_no_episode_found_should_return_with_error_logged()
|
|
|
|
public void start_no_episode_found_should_return_with_error_logged()
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -381,5 +386,51 @@ namespace NzbDrone.Core.Test
|
|
|
|
mocker.VerifyAllMocks();
|
|
|
|
mocker.VerifyAllMocks();
|
|
|
|
ExceptionVerification.ExcpectedErrors(1);
|
|
|
|
ExceptionVerification.ExcpectedErrors(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
|
|
|
public void episode_search_should_call_get_series()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var parseResults = Builder<EpisodeParseResult>.CreateListOfSize(4)
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
|
|
|
|
.With(c => c.Series = Builder<Series>.CreateNew().Build())
|
|
|
|
|
|
|
|
.With(c => c.SeasonNumber = 12)
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var mocker = new AutoMoqer(MockBehavior.Strict);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mocker.GetMock<EpisodeProvider>()
|
|
|
|
|
|
|
|
.Setup(c => c.GetEpisode(episode.EpisodeId))
|
|
|
|
|
|
|
|
.Returns(episode);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var indexer1 = new Mock<IndexerBase>();
|
|
|
|
|
|
|
|
indexer1.Setup(c => c.FetchEpisode(episode.Series.Title, episode.SeasonNumber, episode.EpisodeNumber))
|
|
|
|
|
|
|
|
.Returns(parseResults).Verifiable();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var indexers = new List<IndexerBase> { indexer1.Object };
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mocker.GetMock<IndexerProvider>()
|
|
|
|
|
|
|
|
.Setup(c => c.GetEnabledIndexers())
|
|
|
|
|
|
|
|
.Returns(indexers);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mocker.GetMock<InventoryProvider>()
|
|
|
|
|
|
|
|
.Setup(c => c.IsQualityNeeded(It.IsAny<EpisodeParseResult>())).Returns(false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mocker.GetMock<SceneMappingProvider>()
|
|
|
|
|
|
|
|
.Setup(s => s.GetSceneName(It.IsAny<int>())).Returns("");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mocker.GetMock<SeriesProvider>()
|
|
|
|
|
|
|
|
.Setup(s => s.GetSeries(It.IsAny<int>())).Returns(episode.Series);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
|
|
|
mocker.Resolve<SearchProvider>().EpisodeSearch(new ProgressNotification("Test"), episode.EpisodeId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
|
|
|
mocker.VerifyAllMocks();
|
|
|
|
|
|
|
|
ExceptionVerification.ExcpectedWarns(1);
|
|
|
|
|
|
|
|
indexer1.VerifyAll();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|