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