2013-04-15 03:41:39 +02:00
|
|
|
|
using System.Collections.Generic;
|
2011-09-14 06:37:22 +02:00
|
|
|
|
using FizzWare.NBuilder;
|
|
|
|
|
using FluentAssertions;
|
|
|
|
|
using Moq;
|
|
|
|
|
using NUnit.Framework;
|
2013-03-07 01:19:49 +01:00
|
|
|
|
using NzbDrone.Core.DecisionEngine.Specifications;
|
2013-04-15 03:41:39 +02:00
|
|
|
|
using NzbDrone.Core.Parser.Model;
|
2013-02-27 04:19:22 +01:00
|
|
|
|
using NzbDrone.Core.Qualities;
|
2013-02-19 07:01:03 +01:00
|
|
|
|
using NzbDrone.Core.Tv;
|
2011-09-14 06:37:22 +02:00
|
|
|
|
using NzbDrone.Core.Test.Framework;
|
|
|
|
|
|
2013-02-19 03:19:38 +01:00
|
|
|
|
namespace NzbDrone.Core.Test.DecisionEngineTests
|
2011-09-14 06:37:22 +02:00
|
|
|
|
{
|
|
|
|
|
[TestFixture]
|
2013-04-15 03:41:39 +02:00
|
|
|
|
|
|
|
|
|
public class AcceptableSizeSpecificationFixture : CoreTest<AcceptableSizeSpecification>
|
2011-09-14 06:37:22 +02:00
|
|
|
|
{
|
2013-04-15 03:41:39 +02:00
|
|
|
|
private RemoteEpisode parseResultMulti;
|
|
|
|
|
private RemoteEpisode parseResultSingle;
|
2011-09-14 06:37:22 +02:00
|
|
|
|
private Series series30minutes;
|
|
|
|
|
private Series series60minutes;
|
2013-02-27 04:19:22 +01:00
|
|
|
|
private QualitySize qualityType;
|
2011-09-14 06:37:22 +02:00
|
|
|
|
|
|
|
|
|
[SetUp]
|
2011-10-24 07:54:09 +02:00
|
|
|
|
public void Setup()
|
2011-09-14 06:37:22 +02:00
|
|
|
|
{
|
2013-04-15 03:41:39 +02:00
|
|
|
|
parseResultMulti = new RemoteEpisode
|
2011-09-14 06:37:22 +02:00
|
|
|
|
{
|
2013-04-15 03:41:39 +02:00
|
|
|
|
Report = new ReportInfo(),
|
2013-04-28 21:46:13 +02:00
|
|
|
|
ParsedEpisodeInfo = new ParsedEpisodeInfo { Quality = new QualityModel(Quality.SDTV, true) },
|
2013-04-15 03:41:39 +02:00
|
|
|
|
Episodes = new List<Episode> { new Episode(), new Episode() }
|
2011-09-14 06:37:22 +02:00
|
|
|
|
};
|
|
|
|
|
|
2013-04-15 03:41:39 +02:00
|
|
|
|
parseResultSingle = new RemoteEpisode
|
2011-09-14 06:37:22 +02:00
|
|
|
|
{
|
2013-04-15 03:41:39 +02:00
|
|
|
|
Report = new ReportInfo(),
|
2013-04-28 21:46:13 +02:00
|
|
|
|
ParsedEpisodeInfo = new ParsedEpisodeInfo { Quality = new QualityModel(Quality.SDTV, true) },
|
2013-04-15 03:41:39 +02:00
|
|
|
|
Episodes = new List<Episode> { new Episode() }
|
|
|
|
|
|
2011-09-14 06:37:22 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
series30minutes = Builder<Series>.CreateNew()
|
|
|
|
|
.With(c => c.Runtime = 30)
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
series60minutes = Builder<Series>.CreateNew()
|
|
|
|
|
.With(c => c.Runtime = 60)
|
|
|
|
|
.Build();
|
|
|
|
|
|
2013-02-27 04:19:22 +01:00
|
|
|
|
qualityType = Builder<QualitySize>.CreateNew()
|
2011-09-14 06:37:22 +02:00
|
|
|
|
.With(q => q.MinSize = 0)
|
2011-09-16 06:42:30 +02:00
|
|
|
|
.With(q => q.MaxSize = 10)
|
2013-02-27 04:19:22 +01:00
|
|
|
|
.With(q => q.QualityId = 1)
|
2011-09-14 06:37:22 +02:00
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void IsAcceptableSize_true_single_episode_not_first_or_last_30_minute()
|
|
|
|
|
{
|
|
|
|
|
parseResultSingle.Series = series30minutes;
|
2013-04-15 03:41:39 +02:00
|
|
|
|
parseResultSingle.Report.Size = 184572800;
|
2011-09-14 06:37:22 +02:00
|
|
|
|
|
2013-02-27 04:32:22 +01:00
|
|
|
|
Mocker.GetMock<IQualitySizeService>().Setup(s => s.Get(1)).Returns(qualityType);
|
2011-09-14 06:37:22 +02:00
|
|
|
|
|
2013-02-22 01:47:09 +01:00
|
|
|
|
Mocker.GetMock<IEpisodeService>().Setup(
|
2013-04-15 03:41:39 +02:00
|
|
|
|
s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>()))
|
2011-09-14 06:37:22 +02:00
|
|
|
|
.Returns(false);
|
|
|
|
|
|
|
|
|
|
|
2013-08-07 05:18:05 +02:00
|
|
|
|
bool result = Subject.IsSatisfiedBy(parseResultSingle, null);
|
2013-04-15 03:41:39 +02:00
|
|
|
|
|
|
|
|
|
|
2011-09-14 06:37:22 +02:00
|
|
|
|
result.Should().BeTrue();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void IsAcceptableSize_true_single_episode_not_first_or_last_60_minute()
|
|
|
|
|
{
|
|
|
|
|
parseResultSingle.Series = series60minutes;
|
2013-04-15 03:41:39 +02:00
|
|
|
|
parseResultSingle.Report.Size = 368572800;
|
2011-09-14 06:37:22 +02:00
|
|
|
|
|
2013-02-27 04:32:22 +01:00
|
|
|
|
Mocker.GetMock<IQualitySizeService>().Setup(s => s.Get(1)).Returns(qualityType);
|
2011-09-14 06:37:22 +02:00
|
|
|
|
|
2013-02-22 01:47:09 +01:00
|
|
|
|
Mocker.GetMock<IEpisodeService>().Setup(
|
2013-04-15 03:41:39 +02:00
|
|
|
|
s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>()))
|
2011-09-14 06:37:22 +02:00
|
|
|
|
.Returns(false);
|
|
|
|
|
|
|
|
|
|
|
2013-08-07 05:18:05 +02:00
|
|
|
|
bool result = Subject.IsSatisfiedBy(parseResultSingle, null);
|
2013-04-15 03:41:39 +02:00
|
|
|
|
|
|
|
|
|
|
2011-09-14 06:37:22 +02:00
|
|
|
|
result.Should().BeTrue();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void IsAcceptableSize_false_single_episode_not_first_or_last_30_minute()
|
|
|
|
|
{
|
|
|
|
|
parseResultSingle.Series = series30minutes;
|
2013-04-15 03:41:39 +02:00
|
|
|
|
parseResultSingle.Report.Size = 1.Gigabytes();
|
2011-09-14 06:37:22 +02:00
|
|
|
|
|
2013-02-27 04:32:22 +01:00
|
|
|
|
Mocker.GetMock<IQualitySizeService>().Setup(s => s.Get(1)).Returns(qualityType);
|
2011-09-14 06:37:22 +02:00
|
|
|
|
|
2013-02-22 01:47:09 +01:00
|
|
|
|
Mocker.GetMock<IEpisodeService>().Setup(
|
2013-04-15 03:41:39 +02:00
|
|
|
|
s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>()))
|
2011-09-14 06:37:22 +02:00
|
|
|
|
.Returns(false);
|
|
|
|
|
|
|
|
|
|
|
2013-08-07 05:18:05 +02:00
|
|
|
|
bool result = Subject.IsSatisfiedBy(parseResultSingle, null);
|
2013-04-15 03:41:39 +02:00
|
|
|
|
|
|
|
|
|
|
2011-09-14 06:37:22 +02:00
|
|
|
|
result.Should().BeFalse();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void IsAcceptableSize_false_single_episode_not_first_or_last_60_minute()
|
|
|
|
|
{
|
|
|
|
|
parseResultSingle.Series = series60minutes;
|
2013-04-15 03:41:39 +02:00
|
|
|
|
parseResultSingle.Report.Size = 1.Gigabytes();
|
2011-09-14 06:37:22 +02:00
|
|
|
|
|
2013-02-27 04:32:22 +01:00
|
|
|
|
Mocker.GetMock<IQualitySizeService>().Setup(s => s.Get(1)).Returns(qualityType);
|
2011-09-14 06:37:22 +02:00
|
|
|
|
|
2013-02-22 01:47:09 +01:00
|
|
|
|
Mocker.GetMock<IEpisodeService>().Setup(
|
2013-04-15 03:41:39 +02:00
|
|
|
|
s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>()))
|
2011-09-14 06:37:22 +02:00
|
|
|
|
.Returns(false);
|
|
|
|
|
|
2013-08-07 05:18:05 +02:00
|
|
|
|
bool result = Subject.IsSatisfiedBy(parseResultSingle, null);
|
2013-04-15 03:41:39 +02:00
|
|
|
|
|
2011-09-14 06:37:22 +02:00
|
|
|
|
result.Should().BeFalse();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void IsAcceptableSize_true_multi_episode_not_first_or_last_30_minute()
|
|
|
|
|
{
|
|
|
|
|
parseResultMulti.Series = series30minutes;
|
2013-04-15 03:41:39 +02:00
|
|
|
|
parseResultMulti.Report.Size = 184572800;
|
2011-09-14 06:37:22 +02:00
|
|
|
|
|
2013-02-27 04:32:22 +01:00
|
|
|
|
Mocker.GetMock<IQualitySizeService>().Setup(s => s.Get(1)).Returns(qualityType);
|
2011-09-14 06:37:22 +02:00
|
|
|
|
|
2013-02-22 01:47:09 +01:00
|
|
|
|
Mocker.GetMock<IEpisodeService>().Setup(
|
2013-04-15 03:41:39 +02:00
|
|
|
|
s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>()))
|
2011-09-14 06:37:22 +02:00
|
|
|
|
.Returns(false);
|
|
|
|
|
|
|
|
|
|
|
2013-08-07 05:18:05 +02:00
|
|
|
|
bool result = Subject.IsSatisfiedBy(parseResultMulti, null);
|
2013-04-15 03:41:39 +02:00
|
|
|
|
|
|
|
|
|
|
2011-09-14 06:37:22 +02:00
|
|
|
|
result.Should().BeTrue();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void IsAcceptableSize_true_multi_episode_not_first_or_last_60_minute()
|
|
|
|
|
{
|
|
|
|
|
parseResultMulti.Series = series60minutes;
|
2013-04-15 03:41:39 +02:00
|
|
|
|
parseResultMulti.Report.Size = 368572800;
|
2011-09-14 06:37:22 +02:00
|
|
|
|
|
2013-02-27 04:32:22 +01:00
|
|
|
|
Mocker.GetMock<IQualitySizeService>().Setup(s => s.Get(1)).Returns(qualityType);
|
2011-09-14 06:37:22 +02:00
|
|
|
|
|
2013-02-22 01:47:09 +01:00
|
|
|
|
Mocker.GetMock<IEpisodeService>().Setup(
|
2013-04-15 03:41:39 +02:00
|
|
|
|
s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>()))
|
2011-09-14 06:37:22 +02:00
|
|
|
|
.Returns(false);
|
|
|
|
|
|
|
|
|
|
|
2013-08-07 05:18:05 +02:00
|
|
|
|
bool result = Subject.IsSatisfiedBy(parseResultMulti, null);
|
2013-04-15 03:41:39 +02:00
|
|
|
|
|
|
|
|
|
|
2011-09-14 06:37:22 +02:00
|
|
|
|
result.Should().BeTrue();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void IsAcceptableSize_false_multi_episode_not_first_or_last_30_minute()
|
|
|
|
|
{
|
|
|
|
|
parseResultMulti.Series = series30minutes;
|
2013-04-15 03:41:39 +02:00
|
|
|
|
parseResultMulti.Report.Size = 1.Gigabytes();
|
2011-09-14 06:37:22 +02:00
|
|
|
|
|
2013-02-27 04:32:22 +01:00
|
|
|
|
Mocker.GetMock<IQualitySizeService>().Setup(s => s.Get(1)).Returns(qualityType);
|
2011-09-14 06:37:22 +02:00
|
|
|
|
|
2013-02-22 01:47:09 +01:00
|
|
|
|
Mocker.GetMock<IEpisodeService>().Setup(
|
2013-04-15 03:41:39 +02:00
|
|
|
|
s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>()))
|
2011-09-14 06:37:22 +02:00
|
|
|
|
.Returns(false);
|
|
|
|
|
|
|
|
|
|
|
2013-08-07 05:18:05 +02:00
|
|
|
|
bool result = Subject.IsSatisfiedBy(parseResultMulti, null);
|
2013-04-15 03:41:39 +02:00
|
|
|
|
|
|
|
|
|
|
2011-09-14 06:37:22 +02:00
|
|
|
|
result.Should().BeFalse();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void IsAcceptableSize_false_multi_episode_not_first_or_last_60_minute()
|
|
|
|
|
{
|
|
|
|
|
parseResultMulti.Series = series60minutes;
|
2013-04-15 03:41:39 +02:00
|
|
|
|
parseResultMulti.Report.Size = 10.Gigabytes();
|
2011-09-14 06:37:22 +02:00
|
|
|
|
|
2013-02-27 04:32:22 +01:00
|
|
|
|
Mocker.GetMock<IQualitySizeService>().Setup(s => s.Get(1)).Returns(qualityType);
|
2011-09-14 06:37:22 +02:00
|
|
|
|
|
2013-02-22 01:47:09 +01:00
|
|
|
|
Mocker.GetMock<IEpisodeService>().Setup(
|
2013-04-15 03:41:39 +02:00
|
|
|
|
s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>()))
|
2011-09-14 06:37:22 +02:00
|
|
|
|
.Returns(false);
|
|
|
|
|
|
|
|
|
|
|
2013-08-07 05:18:05 +02:00
|
|
|
|
bool result = Subject.IsSatisfiedBy(parseResultMulti, null);
|
2013-04-15 03:41:39 +02:00
|
|
|
|
|
|
|
|
|
|
2011-09-14 06:37:22 +02:00
|
|
|
|
result.Should().BeFalse();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void IsAcceptableSize_true_single_episode_first_30_minute()
|
|
|
|
|
{
|
|
|
|
|
parseResultSingle.Series = series30minutes;
|
2013-04-15 03:41:39 +02:00
|
|
|
|
parseResultSingle.Report.Size = 184572800;
|
2011-09-14 06:37:22 +02:00
|
|
|
|
|
2013-02-27 04:32:22 +01:00
|
|
|
|
Mocker.GetMock<IQualitySizeService>().Setup(s => s.Get(1)).Returns(qualityType);
|
2011-09-14 06:37:22 +02:00
|
|
|
|
|
2013-02-22 01:47:09 +01:00
|
|
|
|
Mocker.GetMock<IEpisodeService>().Setup(
|
2013-04-15 03:41:39 +02:00
|
|
|
|
s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>()))
|
2011-09-14 06:37:22 +02:00
|
|
|
|
.Returns(true);
|
|
|
|
|
|
|
|
|
|
|
2013-08-07 05:18:05 +02:00
|
|
|
|
bool result = Subject.IsSatisfiedBy(parseResultSingle, null);
|
2013-04-15 03:41:39 +02:00
|
|
|
|
|
|
|
|
|
|
2011-09-14 06:37:22 +02:00
|
|
|
|
result.Should().BeTrue();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void IsAcceptableSize_true_single_episode_first_60_minute()
|
|
|
|
|
{
|
|
|
|
|
parseResultSingle.Series = series60minutes;
|
2013-04-15 03:41:39 +02:00
|
|
|
|
parseResultSingle.Report.Size = 368572800;
|
2011-09-14 06:37:22 +02:00
|
|
|
|
|
2013-02-27 04:32:22 +01:00
|
|
|
|
Mocker.GetMock<IQualitySizeService>().Setup(s => s.Get(1)).Returns(qualityType);
|
2011-09-14 06:37:22 +02:00
|
|
|
|
|
2013-02-22 01:47:09 +01:00
|
|
|
|
Mocker.GetMock<IEpisodeService>().Setup(
|
2013-04-15 03:41:39 +02:00
|
|
|
|
s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>()))
|
2011-09-14 06:37:22 +02:00
|
|
|
|
.Returns(true);
|
|
|
|
|
|
|
|
|
|
|
2013-08-07 05:18:05 +02:00
|
|
|
|
bool result = Subject.IsSatisfiedBy(parseResultSingle, null);
|
2013-04-15 03:41:39 +02:00
|
|
|
|
|
|
|
|
|
|
2011-09-14 06:37:22 +02:00
|
|
|
|
result.Should().BeTrue();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void IsAcceptableSize_false_single_episode_first_30_minute()
|
|
|
|
|
{
|
|
|
|
|
parseResultSingle.Series = series30minutes;
|
2013-04-15 03:41:39 +02:00
|
|
|
|
parseResultSingle.Report.Size = 1.Gigabytes();
|
2011-09-14 06:37:22 +02:00
|
|
|
|
|
2013-02-27 04:32:22 +01:00
|
|
|
|
Mocker.GetMock<IQualitySizeService>().Setup(s => s.Get(1)).Returns(qualityType);
|
2011-09-14 06:37:22 +02:00
|
|
|
|
|
2013-02-22 01:47:09 +01:00
|
|
|
|
Mocker.GetMock<IEpisodeService>().Setup(
|
2013-04-15 03:41:39 +02:00
|
|
|
|
s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>()))
|
2011-09-14 06:37:22 +02:00
|
|
|
|
.Returns(true);
|
|
|
|
|
|
|
|
|
|
|
2013-08-07 05:18:05 +02:00
|
|
|
|
bool result = Subject.IsSatisfiedBy(parseResultSingle, null);
|
2013-04-15 03:41:39 +02:00
|
|
|
|
|
|
|
|
|
|
2011-09-14 06:37:22 +02:00
|
|
|
|
result.Should().BeFalse();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void IsAcceptableSize_false_single_episode_first_60_minute()
|
|
|
|
|
{
|
2013-04-28 21:46:13 +02:00
|
|
|
|
|
2011-09-14 06:37:22 +02:00
|
|
|
|
|
|
|
|
|
parseResultSingle.Series = series60minutes;
|
2013-04-15 03:41:39 +02:00
|
|
|
|
parseResultSingle.Report.Size = 10.Gigabytes();
|
2011-09-14 06:37:22 +02:00
|
|
|
|
|
2013-02-27 04:32:22 +01:00
|
|
|
|
Mocker.GetMock<IQualitySizeService>().Setup(s => s.Get(1)).Returns(qualityType);
|
2011-09-14 06:37:22 +02:00
|
|
|
|
|
2013-02-22 01:47:09 +01:00
|
|
|
|
Mocker.GetMock<IEpisodeService>().Setup(
|
2013-04-15 03:41:39 +02:00
|
|
|
|
s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>()))
|
2011-09-14 06:37:22 +02:00
|
|
|
|
.Returns(true);
|
|
|
|
|
|
|
|
|
|
|
2013-08-07 05:18:05 +02:00
|
|
|
|
bool result = Subject.IsSatisfiedBy(parseResultSingle, null);
|
2013-04-15 03:41:39 +02:00
|
|
|
|
|
|
|
|
|
|
2011-09-14 06:37:22 +02:00
|
|
|
|
result.Should().BeFalse();
|
|
|
|
|
}
|
2011-09-16 06:42:30 +02:00
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void IsAcceptableSize_true_unlimited_30_minute()
|
|
|
|
|
{
|
2013-04-28 21:46:13 +02:00
|
|
|
|
|
2011-09-16 06:42:30 +02:00
|
|
|
|
|
|
|
|
|
parseResultSingle.Series = series30minutes;
|
2013-04-15 03:41:39 +02:00
|
|
|
|
parseResultSingle.Report.Size = 18457280000;
|
2011-09-16 06:42:30 +02:00
|
|
|
|
qualityType.MaxSize = 0;
|
|
|
|
|
|
2013-02-27 04:32:22 +01:00
|
|
|
|
Mocker.GetMock<IQualitySizeService>().Setup(s => s.Get(1)).Returns(qualityType);
|
2011-09-16 06:42:30 +02:00
|
|
|
|
|
2013-02-22 01:47:09 +01:00
|
|
|
|
Mocker.GetMock<IEpisodeService>().Setup(
|
2013-04-15 03:41:39 +02:00
|
|
|
|
s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>()))
|
2011-09-16 06:42:30 +02:00
|
|
|
|
.Returns(true);
|
|
|
|
|
|
|
|
|
|
|
2013-08-07 05:18:05 +02:00
|
|
|
|
bool result = Subject.IsSatisfiedBy(parseResultSingle, null);
|
2013-04-15 03:41:39 +02:00
|
|
|
|
|
|
|
|
|
|
2011-09-16 06:42:30 +02:00
|
|
|
|
result.Should().BeTrue();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void IsAcceptableSize_true_unlimited_60_minute()
|
|
|
|
|
{
|
2013-04-28 21:46:13 +02:00
|
|
|
|
|
2011-09-16 06:42:30 +02:00
|
|
|
|
|
|
|
|
|
parseResultSingle.Series = series60minutes;
|
2013-04-15 03:41:39 +02:00
|
|
|
|
parseResultSingle.Report.Size = 36857280000;
|
2011-09-16 06:42:30 +02:00
|
|
|
|
qualityType.MaxSize = 0;
|
|
|
|
|
|
2013-02-27 04:32:22 +01:00
|
|
|
|
Mocker.GetMock<IQualitySizeService>().Setup(s => s.Get(1)).Returns(qualityType);
|
2011-09-16 06:42:30 +02:00
|
|
|
|
|
2013-02-22 01:47:09 +01:00
|
|
|
|
Mocker.GetMock<IEpisodeService>().Setup(
|
2013-04-15 03:41:39 +02:00
|
|
|
|
s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>()))
|
2011-09-16 06:42:30 +02:00
|
|
|
|
.Returns(true);
|
|
|
|
|
|
|
|
|
|
|
2013-08-07 05:18:05 +02:00
|
|
|
|
bool result = Subject.IsSatisfiedBy(parseResultSingle, null);
|
2013-04-15 03:41:39 +02:00
|
|
|
|
|
|
|
|
|
|
2011-09-16 06:42:30 +02:00
|
|
|
|
result.Should().BeTrue();
|
|
|
|
|
}
|
2011-12-01 06:08:36 +01:00
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void IsAcceptableSize_should_treat_daily_series_as_single_episode()
|
|
|
|
|
{
|
2013-04-15 03:41:39 +02:00
|
|
|
|
|
2011-12-01 06:08:36 +01:00
|
|
|
|
parseResultSingle.Series = series60minutes;
|
2013-04-15 03:41:39 +02:00
|
|
|
|
parseResultSingle.Series.SeriesType = SeriesTypes.Daily;
|
|
|
|
|
|
|
|
|
|
parseResultSingle.Report.Size = 300.Megabytes();
|
2011-12-01 06:08:36 +01:00
|
|
|
|
|
|
|
|
|
qualityType.MaxSize = (int)600.Megabytes();
|
|
|
|
|
|
2013-02-27 04:32:22 +01:00
|
|
|
|
Mocker.GetMock<IQualitySizeService>().Setup(s => s.Get(1)).Returns(qualityType);
|
2011-12-01 06:08:36 +01:00
|
|
|
|
|
2013-02-22 01:47:09 +01:00
|
|
|
|
Mocker.GetMock<IEpisodeService>().Setup(
|
2013-04-15 03:41:39 +02:00
|
|
|
|
s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>()))
|
2011-12-01 06:08:36 +01:00
|
|
|
|
.Returns(true);
|
|
|
|
|
|
|
|
|
|
|
2013-08-07 05:18:05 +02:00
|
|
|
|
bool result = Subject.IsSatisfiedBy(parseResultSingle, null);
|
2013-04-15 03:41:39 +02:00
|
|
|
|
|
|
|
|
|
|
2011-12-01 06:08:36 +01:00
|
|
|
|
result.Should().BeTrue();
|
|
|
|
|
}
|
2013-01-09 09:15:06 +01:00
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_return_true_if_RAWHD()
|
|
|
|
|
{
|
2013-04-15 03:41:39 +02:00
|
|
|
|
var parseResult = new RemoteEpisode
|
2013-01-09 09:15:06 +01:00
|
|
|
|
{
|
2013-04-28 21:46:13 +02:00
|
|
|
|
ParsedEpisodeInfo = new ParsedEpisodeInfo { Quality = new QualityModel(Quality.RAWHD, false) },
|
2013-01-09 09:15:06 +01:00
|
|
|
|
};
|
|
|
|
|
|
2013-08-07 05:18:05 +02:00
|
|
|
|
Subject.IsSatisfiedBy(parseResult, null).Should().BeTrue();
|
2013-01-09 09:15:06 +01:00
|
|
|
|
}
|
2013-06-07 01:05:06 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_always_return_false_if_unknow()
|
|
|
|
|
{
|
|
|
|
|
var parseResult = new RemoteEpisode
|
|
|
|
|
{
|
|
|
|
|
ParsedEpisodeInfo = new ParsedEpisodeInfo { Quality = new QualityModel(Quality.Unknown, false) },
|
|
|
|
|
};
|
|
|
|
|
|
2013-08-07 05:18:05 +02:00
|
|
|
|
Subject.IsSatisfiedBy(parseResult, null).Should().BeFalse();
|
2013-06-07 01:05:06 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<IQualitySizeService>().Verify(c=>c.Get(It.IsAny<int>()),Times.Never());
|
|
|
|
|
}
|
2011-09-14 06:37:22 +02:00
|
|
|
|
}
|
|
|
|
|
}
|