skip report if series title can't be parsed.

This commit is contained in:
Keivan Beigi 2013-06-28 13:23:41 -07:00
parent b56da336c0
commit 2ce5f6d416
3 changed files with 20 additions and 4 deletions

View File

@ -13,7 +13,7 @@ using NzbDrone.Test.Common;
namespace NzbDrone.Core.Test.DecisionEngineTests
{
[TestFixture]
public class AllowedDownloadSpecificationFixture : CoreTest<DownloadDecisionMaker>
public class DownloadDecisionMakerFixture : CoreTest<DownloadDecisionMaker>
{
private List<ReportInfo> _reports;
private RemoteEpisode _remoteEpisode;
@ -142,9 +142,25 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
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<IParsingService>().Verify(c => c.Map(It.IsAny<ParsedEpisodeInfo>()), Times.Never());
_pass1.Verify(c => c.IsSatisfiedBy(It.IsAny<RemoteEpisode>()), Times.Never());
_pass2.Verify(c => c.IsSatisfiedBy(It.IsAny<RemoteEpisode>()), Times.Never());
_pass3.Verify(c => c.IsSatisfiedBy(It.IsAny<RemoteEpisode>()), 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);

View File

@ -203,7 +203,7 @@
<Compile Include="InstrumentationTests\DatabaseTargetFixture.cs" />
<Compile Include="OrganizerTests\GetNewFilenameFixture.cs" />
<Compile Include="DecisionEngineTests\MonitoredEpisodeSpecificationFixture.cs" />
<Compile Include="DecisionEngineTests\AllowedDownloadSpecificationFixture.cs" />
<Compile Include="DecisionEngineTests\DownloadDecisionMakerFixture.cs" />
<Compile Include="TvTests\QualityModelFixture.cs" />
<Compile Include="RootFolderTests\RootFolderServiceFixture.cs" />
<Compile Include="HistoryTests\HistoryRepositoryFixture.cs" />

View File

@ -49,7 +49,7 @@ namespace NzbDrone.Core.DecisionEngine
{
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;