diff --git a/NzbDrone.Core.Test/JobTests/SeasonSearchJobTest.cs b/NzbDrone.Core.Test/JobTests/SeasonSearchJobTest.cs index ebdbeeda5..208f4f441 100644 --- a/NzbDrone.Core.Test/JobTests/SeasonSearchJobTest.cs +++ b/NzbDrone.Core.Test/JobTests/SeasonSearchJobTest.cs @@ -12,6 +12,7 @@ using NzbDrone.Core.Providers; using NzbDrone.Core.Repository; using NzbDrone.Core.Repository.Search; using NzbDrone.Core.Test.Framework; +using NzbDrone.Test.Common; using NzbDrone.Test.Common.AutoMoq; namespace NzbDrone.Core.Test.JobTests @@ -20,12 +21,25 @@ namespace NzbDrone.Core.Test.JobTests // ReSharper disable InconsistentNaming public class SeasonSearchJobTest : CoreTest { + private IList _episodes; + private ProgressNotification notification; [SetUp] public void Setup() { notification = new ProgressNotification("Search"); + + _episodes = Builder.CreateListOfSize(5) + .All() + .With(e => e.SeriesId = 1) + .With(e => e.SeasonNumber = 1) + .With(e => e.Ignored = false) + .With(e => e.AirDate = DateTime.Today.AddDays(-1)) + .Build(); + + Mocker.GetMock() + .Setup(c => c.GetEpisodesBySeason(1, 1)).Returns(_episodes); } [Test] @@ -37,18 +51,9 @@ namespace NzbDrone.Core.Test.JobTests .With(e => e.Success = true) .Build(); - var episodes = Builder.CreateListOfSize(5) - .All() - .With(e => e.SeasonNumber = 1) - .With(e => e.SeriesId = 5) - .Build(); - - Mocker.GetMock() - .Setup(c => c.GetEpisodesBySeason(1, 1)).Returns(episodes); - Mocker.GetMock() .Setup(c => c.PartialSeasonSearch(notification, 1, 1)) - .Returns(episodes.Select(e => e.EpisodeNumber).ToList()); + .Returns(_episodes.Select(e => e.EpisodeNumber).ToList()); //Act Mocker.Resolve().Start(notification, new { SeriesId = 1, SeasonNumber = 1 }); @@ -62,14 +67,6 @@ namespace NzbDrone.Core.Test.JobTests [Test] public void SeasonSearch_partial_season_failure() { - var episodes = Builder.CreateListOfSize(5) - .All() - .With(e => e.SeriesId = 1) - .With(e => e.SeasonNumber = 1) - .With(e => e.Ignored = false) - .With(e => e.AirDate = DateTime.Today.AddDays(-1)) - .Build(); - Mocker.GetMock() .Setup(c => c.PartialSeasonSearch(notification, 1, 1)) .Returns(new List()); @@ -78,7 +75,6 @@ namespace NzbDrone.Core.Test.JobTests Mocker.Resolve().Start(notification, new { SeriesId = 1, SeasonNumber = 1 }); //Assert - Mocker.VerifyAllMocks(); Mocker.GetMock().Verify(c => c.PartialSeasonSearch(notification, 1, 1), Times.Once()); } @@ -123,6 +119,8 @@ namespace NzbDrone.Core.Test.JobTests //Assert Mocker.GetMock().Verify(c => c.PartialSeasonSearch(notification, 1, 1), Times.Never()); Mocker.GetMock().Verify(c => c.Start(notification, new { EpisodeId = It.IsAny() }), Times.Never()); + + ExceptionVerification.ExpectedWarns(1); } } } \ No newline at end of file diff --git a/NzbDrone.Core/Jobs/SeasonSearchJob.cs b/NzbDrone.Core/Jobs/SeasonSearchJob.cs index dc04e4ca2..e1fd232cb 100644 --- a/NzbDrone.Core/Jobs/SeasonSearchJob.cs +++ b/NzbDrone.Core/Jobs/SeasonSearchJob.cs @@ -53,8 +53,9 @@ namespace NzbDrone.Core.Jobs //3 searches should guarentee results, (24 eps) versus, a potential 4 to get the same eps. List successes = _searchProvider.PartialSeasonSearch(notification, options.SeriesId, options.SeasonNumber); - if (successes.Count == 0) - return; + //This causes issues with Newznab + //if (successes.Count == 0) + // return; Logger.Debug("Getting episodes from database for series: {0} and season: {1}", options.SeriesId, options.SeasonNumber); List episodes = _episodeProvider.GetEpisodesBySeason(options.SeriesId, options.SeasonNumber);