Fixed a bug in SeriesSearchJob that would cause it to fail.

pull/6/head
kay.one 13 years ago
parent 313d0f6b8e
commit 60814fde7b

@ -61,5 +61,19 @@ namespace NzbDrone.Core.Test.JobTests
mocker.GetMock<SeasonSearchJob>().Verify(c => c.Start(notification, 1, It.IsAny<int>()), mocker.GetMock<SeasonSearchJob>().Verify(c => c.Start(notification, 1, It.IsAny<int>()),
Times.Never()); Times.Never());
} }
[Test]
public void SeriesSearch_should_not_search_for_season_0()
{
Mocker.GetMock<EpisodeProvider>()
.Setup(c => c.GetSeasons(It.IsAny<int>()))
.Returns(new List<int> { 0, 1, 2 });
Mocker.Resolve<SeriesSearchJob>().Start(MockNotification, 12, 0);
Mocker.GetMock<SeasonSearchJob>()
.Verify(c => c.Start(It.IsAny<ProgressNotification>(), It.IsAny<int>(), 0), Times.Never());
}
} }
} }

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using NLog; using NLog;
using NzbDrone.Core.Model; using NzbDrone.Core.Model;
using NzbDrone.Core.Model.Notification; using NzbDrone.Core.Model.Notification;
@ -36,7 +37,7 @@ namespace NzbDrone.Core.Providers.Jobs
throw new ArgumentOutOfRangeException("targetId"); throw new ArgumentOutOfRangeException("targetId");
Logger.Debug("Getting seasons from database for series: {0}", 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) foreach (var season in seasons)
{ {

Loading…
Cancel
Save