2013-03-07 03:19:49 +03:00
|
|
|
using FluentAssertions;
|
|
|
|
using NUnit.Framework;
|
|
|
|
using NzbDrone.Core.Qualities;
|
|
|
|
using NzbDrone.Core.Tv;
|
|
|
|
using NzbDrone.Core.DecisionEngine;
|
|
|
|
using NzbDrone.Core.Test.Framework;
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.Test.DecisionEngineTests
|
|
|
|
{
|
|
|
|
[TestFixture]
|
2013-09-11 05:07:22 +03:00
|
|
|
public class CutoffSpecificationFixture : CoreTest<QualityUpgradableSpecification>
|
2013-03-07 03:19:49 +03:00
|
|
|
{
|
|
|
|
[Test]
|
2013-09-11 08:45:08 +03:00
|
|
|
public void should_return_true_if_current_episode_is_less_than_cutoff()
|
2013-03-07 03:19:49 +03:00
|
|
|
{
|
2013-09-11 05:07:22 +03:00
|
|
|
Subject.CutoffNotMet(new QualityProfile { Cutoff = Quality.Bluray1080p },
|
2013-03-07 03:19:49 +03:00
|
|
|
new QualityModel(Quality.DVD, true)).Should().BeTrue();
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
2013-09-11 08:45:08 +03:00
|
|
|
public void should_return_false_if_current_episode_is_equal_to_cutoff()
|
2013-03-07 03:19:49 +03:00
|
|
|
{
|
2013-09-11 05:07:22 +03:00
|
|
|
Subject.CutoffNotMet(new QualityProfile { Cutoff = Quality.HDTV720p },
|
2013-03-07 03:19:49 +03:00
|
|
|
new QualityModel(Quality.HDTV720p, true)).Should().BeFalse();
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
2013-09-11 08:45:08 +03:00
|
|
|
public void should_return_false_if_current_episode_is_greater_than_cutoff()
|
2013-03-07 03:19:49 +03:00
|
|
|
{
|
2013-09-11 05:07:22 +03:00
|
|
|
Subject.CutoffNotMet(new QualityProfile { Cutoff = Quality.HDTV720p },
|
2013-03-07 03:19:49 +03:00
|
|
|
new QualityModel(Quality.Bluray1080p, true)).Should().BeFalse();
|
|
|
|
}
|
2013-09-11 08:45:08 +03:00
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void should_return_true_when_new_episode_is_proper_but_existing_is_not()
|
|
|
|
{
|
|
|
|
Subject.CutoffNotMet(new QualityProfile { Cutoff = Quality.HDTV720p },
|
|
|
|
new QualityModel(Quality.HDTV720p, false), new QualityModel(Quality.HDTV720p, true)).Should().BeTrue();
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void should_return_false_if_cutoff_is_met_and_quality_is_higher()
|
|
|
|
{
|
|
|
|
Subject.CutoffNotMet(new QualityProfile { Cutoff = Quality.HDTV720p },
|
|
|
|
new QualityModel(Quality.HDTV720p, true), new QualityModel(Quality.Bluray1080p, true)).Should().BeFalse();
|
|
|
|
}
|
2013-03-07 03:19:49 +03:00
|
|
|
}
|
|
|
|
}
|