1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2026-04-25 22:46:31 -04:00

New: Reject multi-season releases

Closes #683
This commit is contained in:
Mark McDowall
2019-04-27 18:27:05 -07:00
parent a9a3e50179
commit 7991ed0154
8 changed files with 118 additions and 4 deletions
@@ -0,0 +1,61 @@

using System;
using NUnit.Framework;
using NzbDrone.Core.DecisionEngine.Specifications;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Test.Framework;
using FizzWare.NBuilder;
using System.Linq;
using FluentAssertions;
using NzbDrone.Core.Tv;
using Moq;
using System.Collections.Generic;
namespace NzbDrone.Core.Test.DecisionEngineTests
{
[TestFixture]
public class MultiSeasonSpecificationFixture : CoreTest<MultiSeasonSpecification>
{
private RemoteEpisode _remoteEpisode;
[SetUp]
public void Setup()
{
var series = Builder<Series>.CreateNew().With(s => s.Id = 1234).Build();
_remoteEpisode = new RemoteEpisode
{
ParsedEpisodeInfo = new ParsedEpisodeInfo
{
FullSeason = true,
IsMultiSeason = true
},
Episodes = Builder<Episode>.CreateListOfSize(3)
.All()
.With(s => s.SeriesId = series.Id)
.BuildList(),
Series = series,
Release = new ReleaseInfo
{
Title = "Series.Title.S01-05.720p.BluRay.X264-RlsGrp"
}
};
Mocker.GetMock<IEpisodeService>().Setup(s => s.EpisodesBetweenDates(It.IsAny<DateTime>(), It.IsAny<DateTime>(), false))
.Returns(new List<Episode>());
}
[Test]
public void should_return_true_if_is_not_a_multi_season_release()
{
_remoteEpisode.ParsedEpisodeInfo.IsMultiSeason = false;
_remoteEpisode.Episodes.Last().AirDateUtc = DateTime.UtcNow.AddDays(+2);
Subject.IsSatisfiedBy(_remoteEpisode, null).Accepted.Should().BeTrue();
}
[Test]
public void should_return_false_if_is_a_multi_season_release()
{
Subject.IsSatisfiedBy(_remoteEpisode, null).Accepted.Should().BeFalse();
}
}
}