From 60814fde7b59d6b8eae86234739d4acedb58e7eb Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Fri, 25 Nov 2011 23:52:54 -0800 Subject: [PATCH] Fixed a bug in SeriesSearchJob that would cause it to fail. --- NzbDrone.Core.Test/JobTests/SeriesSearchJobTest.cs | 14 ++++++++++++++ NzbDrone.Core/Providers/Jobs/SeriesSearchJob.cs | 3 ++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/NzbDrone.Core.Test/JobTests/SeriesSearchJobTest.cs b/NzbDrone.Core.Test/JobTests/SeriesSearchJobTest.cs index 72b4ce867..4733718bc 100644 --- a/NzbDrone.Core.Test/JobTests/SeriesSearchJobTest.cs +++ b/NzbDrone.Core.Test/JobTests/SeriesSearchJobTest.cs @@ -61,5 +61,19 @@ namespace NzbDrone.Core.Test.JobTests mocker.GetMock().Verify(c => c.Start(notification, 1, It.IsAny()), Times.Never()); } + + [Test] + public void SeriesSearch_should_not_search_for_season_0() + { + Mocker.GetMock() + .Setup(c => c.GetSeasons(It.IsAny())) + .Returns(new List { 0, 1, 2 }); + + Mocker.Resolve().Start(MockNotification, 12, 0); + + + Mocker.GetMock() + .Verify(c => c.Start(It.IsAny(), It.IsAny(), 0), Times.Never()); + } } } \ No newline at end of file diff --git a/NzbDrone.Core/Providers/Jobs/SeriesSearchJob.cs b/NzbDrone.Core/Providers/Jobs/SeriesSearchJob.cs index 2de0d0324..0debaf775 100644 --- a/NzbDrone.Core/Providers/Jobs/SeriesSearchJob.cs +++ b/NzbDrone.Core/Providers/Jobs/SeriesSearchJob.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using NLog; using NzbDrone.Core.Model; using NzbDrone.Core.Model.Notification; @@ -36,7 +37,7 @@ namespace NzbDrone.Core.Providers.Jobs throw new ArgumentOutOfRangeException("targetId"); Logger.Debug("Getting seasons from database for series: {0}", targetId); - var seasons = _episodeProvider.GetSeasons(targetId); + var seasons = _episodeProvider.GetSeasons(targetId).Where(s => s > 0); foreach (var season in seasons) {