mirror of
https://github.com/Sonarr/Sonarr.git
synced 2026-04-24 22:36:19 -04:00
Fixed: Anime season searches rejecting season packs
This commit is contained in:
+47
@@ -0,0 +1,47 @@
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.DecisionEngine.Specifications.Search;
|
||||
using NzbDrone.Core.IndexerSearch.Definitions;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Test.Common;
|
||||
|
||||
namespace NzbDrone.Core.Test.DecisionEngineTests.Search.SingleEpisodeSearchMatchSpecificationTests
|
||||
{
|
||||
[TestFixture]
|
||||
public class AnimeSearchFixture : TestBase<SingleEpisodeSearchMatchSpecification>
|
||||
{
|
||||
private RemoteEpisode _remoteEpisode = new RemoteEpisode();
|
||||
private AnimeEpisodeSearchCriteria _searchCriteria = new AnimeEpisodeSearchCriteria();
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
_remoteEpisode.ParsedEpisodeInfo = new ParsedEpisodeInfo();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_false_if_full_season_result_for_single_episode_search()
|
||||
{
|
||||
_remoteEpisode.ParsedEpisodeInfo.FullSeason = true;
|
||||
|
||||
Subject.IsSatisfiedBy(_remoteEpisode, _searchCriteria).Accepted.Should().BeFalse();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_true_if_not_a_full_season_result()
|
||||
{
|
||||
_remoteEpisode.ParsedEpisodeInfo.FullSeason = false;
|
||||
|
||||
Subject.IsSatisfiedBy(_remoteEpisode, _searchCriteria).Accepted.Should().BeTrue();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_true_if_full_season_result_for_full_season_search()
|
||||
{
|
||||
_remoteEpisode.ParsedEpisodeInfo.FullSeason = true;
|
||||
_searchCriteria.IsSeasonSearch = true;
|
||||
|
||||
Subject.IsSatisfiedBy(_remoteEpisode, _searchCriteria).Accepted.Should().BeTrue();
|
||||
}
|
||||
}
|
||||
}
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
using System;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.DecisionEngine.Specifications.Search;
|
||||
using NzbDrone.Core.IndexerSearch.Definitions;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Test.Common;
|
||||
|
||||
namespace NzbDrone.Core.Test.DecisionEngineTests.Search.SingleEpisodeSearchMatchSpecificationTests
|
||||
{
|
||||
[TestFixture]
|
||||
public class StandardEpisodeSearch : TestBase<SingleEpisodeSearchMatchSpecification>
|
||||
{
|
||||
private RemoteEpisode _remoteEpisode = new RemoteEpisode();
|
||||
private SingleEpisodeSearchCriteria _searchCriteria = new SingleEpisodeSearchCriteria();
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
_remoteEpisode.ParsedEpisodeInfo = new ParsedEpisodeInfo();
|
||||
_remoteEpisode.ParsedEpisodeInfo.SeasonNumber = 5;
|
||||
_remoteEpisode.ParsedEpisodeInfo.EpisodeNumbers = new[] { 1 };
|
||||
|
||||
_searchCriteria.SeasonNumber = 5;
|
||||
_searchCriteria.EpisodeNumber = 1;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_false_if_season_does_not_match()
|
||||
{
|
||||
_remoteEpisode.ParsedEpisodeInfo.SeasonNumber = 10;
|
||||
|
||||
Subject.IsSatisfiedBy(_remoteEpisode, _searchCriteria).Accepted.Should().BeFalse();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_false_if_full_season_result_for_single_episode_search()
|
||||
{
|
||||
_remoteEpisode.ParsedEpisodeInfo.EpisodeNumbers = Array.Empty<int>();
|
||||
|
||||
Subject.IsSatisfiedBy(_remoteEpisode, _searchCriteria).Accepted.Should().BeFalse();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_false_if_episode_number_does_not_match_search_criteria()
|
||||
{
|
||||
_remoteEpisode.ParsedEpisodeInfo.EpisodeNumbers = new []{ 2 };
|
||||
|
||||
Subject.IsSatisfiedBy(_remoteEpisode, _searchCriteria).Accepted.Should().BeFalse();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_true_if_full_season_result_for_full_season_search()
|
||||
{
|
||||
Subject.IsSatisfiedBy(_remoteEpisode, _searchCriteria).Accepted.Should().BeTrue();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user