From 2ce5f6d416262bbedd1bd5d6547a587e30d12691 Mon Sep 17 00:00:00 2001 From: Keivan Beigi Date: Fri, 28 Jun 2013 13:23:41 -0700 Subject: [PATCH] skip report if series title can't be parsed. --- ...ure.cs => DownloadDecisionMakerFixture.cs} | 20 +++++++++++++++++-- NzbDrone.Core.Test/NzbDrone.Core.Test.csproj | 2 +- .../DecisionEngine/DownloadDecisionMaker.cs | 2 +- 3 files changed, 20 insertions(+), 4 deletions(-) rename NzbDrone.Core.Test/DecisionEngineTests/{AllowedDownloadSpecificationFixture.cs => DownloadDecisionMakerFixture.cs} (89%) diff --git a/NzbDrone.Core.Test/DecisionEngineTests/AllowedDownloadSpecificationFixture.cs b/NzbDrone.Core.Test/DecisionEngineTests/DownloadDecisionMakerFixture.cs similarity index 89% rename from NzbDrone.Core.Test/DecisionEngineTests/AllowedDownloadSpecificationFixture.cs rename to NzbDrone.Core.Test/DecisionEngineTests/DownloadDecisionMakerFixture.cs index 6fcd045ea..6b9ecaa02 100644 --- a/NzbDrone.Core.Test/DecisionEngineTests/AllowedDownloadSpecificationFixture.cs +++ b/NzbDrone.Core.Test/DecisionEngineTests/DownloadDecisionMakerFixture.cs @@ -13,7 +13,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests { [TestFixture] - public class AllowedDownloadSpecificationFixture : CoreTest + public class DownloadDecisionMakerFixture : CoreTest { private List _reports; private RemoteEpisode _remoteEpisode; @@ -142,9 +142,25 @@ public void should_not_attempt_to_map_episode_if_not_parsable() results.Should().BeEmpty(); } + [Test] public void should_not_attempt_to_map_episode_series_title_is_blank() + { + GivenSpecifications(_pass1, _pass2, _pass3); + _reports[0].Title = "1937 - Snow White and the Seven Dwarves"; + + var results = Subject.GetRssDecision(_reports).ToList(); + + Mocker.GetMock().Verify(c => c.Map(It.IsAny()), Times.Never()); + + _pass1.Verify(c => c.IsSatisfiedBy(It.IsAny()), Times.Never()); + _pass2.Verify(c => c.IsSatisfiedBy(It.IsAny()), Times.Never()); + _pass3.Verify(c => c.IsSatisfiedBy(It.IsAny()), Times.Never()); + + results.Should().BeEmpty(); + } + [Test] - public void should_not_attempt_to_make_decision_if_series_is_unknow() + public void should_not_attempt_to_make_decision_if_series_is_unknown() { GivenSpecifications(_pass1, _pass2, _pass3); diff --git a/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj b/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj index b313da693..8a6550da1 100644 --- a/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj +++ b/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj @@ -203,7 +203,7 @@ - + diff --git a/NzbDrone.Core/DecisionEngine/DownloadDecisionMaker.cs b/NzbDrone.Core/DecisionEngine/DownloadDecisionMaker.cs index 1258ba27b..097addee6 100644 --- a/NzbDrone.Core/DecisionEngine/DownloadDecisionMaker.cs +++ b/NzbDrone.Core/DecisionEngine/DownloadDecisionMaker.cs @@ -49,7 +49,7 @@ private IEnumerable GetDecisions(IEnumerable repor { var parsedEpisodeInfo = Parser.Parser.ParseTitle(report.Title); - if (parsedEpisodeInfo != null) + if (parsedEpisodeInfo != null && !string.IsNullOrWhiteSpace(parsedEpisodeInfo.SeriesTitle)) { var remoteEpisode = _parsingService.Map(parsedEpisodeInfo); remoteEpisode.Report = report;