Add Test for Non-Parsable Search

This commit is contained in:
Qstick 2020-09-06 00:09:44 -04:00
parent 9b1dc2d21d
commit 7ddb8ecc37
1 changed files with 18 additions and 4 deletions

View File

@ -130,19 +130,17 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
_reports[0].Title = "Not parsable"; _reports[0].Title = "Not parsable";
_mappingResult.MappingResultType = MappingResultType.NotParsable; _mappingResult.MappingResultType = MappingResultType.NotParsable;
var results = Subject.GetRssDecision(_reports).ToList(); Subject.GetRssDecision(_reports).ToList();
Mocker.GetMock<IParsingService>().Verify(c => c.Map(It.IsAny<ParsedMovieInfo>(), It.IsAny<string>(), It.IsAny<SearchCriteriaBase>()), Times.Never()); Mocker.GetMock<IParsingService>().Verify(c => c.Map(It.IsAny<ParsedMovieInfo>(), It.IsAny<string>(), It.IsAny<SearchCriteriaBase>()), Times.Never());
_pass1.Verify(c => c.IsSatisfiedBy(It.IsAny<RemoteMovie>(), null), Times.Never()); _pass1.Verify(c => c.IsSatisfiedBy(It.IsAny<RemoteMovie>(), null), Times.Never());
_pass2.Verify(c => c.IsSatisfiedBy(It.IsAny<RemoteMovie>(), null), Times.Never()); _pass2.Verify(c => c.IsSatisfiedBy(It.IsAny<RemoteMovie>(), null), Times.Never());
_pass3.Verify(c => c.IsSatisfiedBy(It.IsAny<RemoteMovie>(), null), Times.Never()); _pass3.Verify(c => c.IsSatisfiedBy(It.IsAny<RemoteMovie>(), null), Times.Never());
results.Should().NotBeEmpty();
} }
[Test] [Test]
public void should_not_attempt_to_map_episode_series_title_is_blank() public void should_not_attempt_to_map_episode_if_series_title_is_blank()
{ {
GivenSpecifications(_pass1, _pass2, _pass3); GivenSpecifications(_pass1, _pass2, _pass3);
_reports[0].Title = "1937 - Snow White and the Seven Dwarves"; _reports[0].Title = "1937 - Snow White and the Seven Dwarves";
@ -159,6 +157,22 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
results.Should().NotBeEmpty(); results.Should().NotBeEmpty();
} }
[Test]
public void should_return_rejected_result_for_unparsable_search()
{
GivenSpecifications(_pass1, _pass2, _pass3);
_reports[0].Title = "1937 - Snow White and the Seven Dwarves";
_mappingResult.MappingResultType = MappingResultType.NotParsable;
Subject.GetSearchDecision(_reports, new MovieSearchCriteria()).ToList();
Mocker.GetMock<IParsingService>().Verify(c => c.Map(It.IsAny<ParsedMovieInfo>(), It.IsAny<string>(), It.IsAny<SearchCriteriaBase>()), Times.Never());
_pass1.Verify(c => c.IsSatisfiedBy(It.IsAny<RemoteMovie>(), null), Times.Never());
_pass2.Verify(c => c.IsSatisfiedBy(It.IsAny<RemoteMovie>(), null), Times.Never());
_pass3.Verify(c => c.IsSatisfiedBy(It.IsAny<RemoteMovie>(), null), Times.Never());
}
[Test] [Test]
public void should_not_attempt_to_make_decision_if_series_is_unknown() public void should_not_attempt_to_make_decision_if_series_is_unknown()
{ {