From b7fea36045bc653e5913db287c67f3bc9f09b7f0 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Thu, 3 May 2012 22:58:42 -0700 Subject: [PATCH] Fixed: Season searching won't fail when search for season 0 (specials). --- .../JobTests/SeasonSearchJobTest.cs | 17 +++++++++++++++++ NzbDrone.Core/Jobs/SeasonSearchJob.cs | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/NzbDrone.Core.Test/JobTests/SeasonSearchJobTest.cs b/NzbDrone.Core.Test/JobTests/SeasonSearchJobTest.cs index 8ca03f86b..f5050ac6b 100644 --- a/NzbDrone.Core.Test/JobTests/SeasonSearchJobTest.cs +++ b/NzbDrone.Core.Test/JobTests/SeasonSearchJobTest.cs @@ -141,5 +141,22 @@ namespace NzbDrone.Core.Test.JobTests Mocker.GetMock().Verify(c => c.SeasonSearch(notification, 1, 1), Times.Once()); Mocker.GetMock().Verify(c => c.PartialSeasonSearch(notification, 1, 1), Times.Once()); } + + [Test] + public void SeasonSearch_should_allow_searching_of_season_zero() + { + var notification = new ProgressNotification("Season Search"); + + Mocker.GetMock() + .Setup(c => c.SeasonSearch(notification, 1, 0)).Returns(true); + + //Act + Mocker.Resolve().Start(notification, 1, 0); + + //Assert + Mocker.GetMock().Verify(c => c.SeasonSearch(notification, 1, 0), Times.Once()); + Mocker.GetMock().Verify(c => c.PartialSeasonSearch(notification, 1, 1), Times.Never()); + Mocker.GetMock().Verify(c => c.Start(notification, It.IsAny(), 0), Times.Never()); + } } } \ No newline at end of file diff --git a/NzbDrone.Core/Jobs/SeasonSearchJob.cs b/NzbDrone.Core/Jobs/SeasonSearchJob.cs index 1ac305bd7..ea1957389 100644 --- a/NzbDrone.Core/Jobs/SeasonSearchJob.cs +++ b/NzbDrone.Core/Jobs/SeasonSearchJob.cs @@ -42,7 +42,7 @@ namespace NzbDrone.Core.Jobs if (targetId <= 0) throw new ArgumentOutOfRangeException("targetId"); - if (secondaryTargetId <= 0) + if (secondaryTargetId < 0) throw new ArgumentOutOfRangeException("secondaryTargetId"); if (_searchProvider.SeasonSearch(notification, targetId, secondaryTargetId))