1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-09 04:22:30 +01:00
Radarr/NzbDrone.Core.Test/DecisionEngineTests/QualityAllowedByProfileSpecificationFixture.cs

67 lines
2.2 KiB
C#
Raw Normal View History

2013-03-28 23:07:09 +01:00

using System.Collections.Generic;
using FizzWare.NBuilder;
using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Core.DecisionEngine.Specifications;
using NzbDrone.Core.Parser.Model;
2013-02-27 04:19:22 +01:00
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Test.Framework;
2013-02-19 03:19:38 +01:00
namespace NzbDrone.Core.Test.DecisionEngineTests
{
[TestFixture]
public class QualityAllowedByProfileSpecificationFixture : CoreTest<QualityAllowedByProfileSpecification>
{
private RemoteEpisode parseResult;
2012-10-14 02:36:16 +02:00
public static object[] AllowedTestCases =
{
2013-02-27 04:19:22 +01:00
new object[] { Quality.DVD },
new object[] { Quality.HDTV720p },
new object[] { Quality.Bluray1080p }
2012-10-14 02:36:16 +02:00
};
public static object[] DeniedTestCases =
{
2013-02-27 04:19:22 +01:00
new object[] { Quality.SDTV },
new object[] { Quality.WEBDL720p },
new object[] { Quality.Bluray720p }
2012-10-14 02:36:16 +02:00
};
[SetUp]
public void Setup()
{
var fakeSeries = Builder<Series>.CreateNew()
2013-02-27 04:19:22 +01:00
.With(c => c.QualityProfile = new QualityProfile { Cutoff = Quality.Bluray1080p })
.Build();
parseResult = new RemoteEpisode
{
Series = fakeSeries,
2013-02-27 04:19:22 +01:00
Quality = new QualityModel(Quality.DVD, true),
};
}
2012-10-14 02:36:16 +02:00
[Test, TestCaseSource("AllowedTestCases")]
2013-02-27 04:19:22 +01:00
public void should_allow_if_quality_is_defined_in_profile(Quality qualityType)
{
2012-10-14 02:36:16 +02:00
parseResult.Quality.Quality = qualityType;
2013-02-27 04:19:22 +01:00
parseResult.Series.QualityProfile.Allowed = new List<Quality> { Quality.DVD, Quality.HDTV720p, Quality.Bluray1080p };
Subject.IsSatisfiedBy(parseResult).Should().BeTrue();
}
2012-10-14 02:36:16 +02:00
[Test, TestCaseSource("DeniedTestCases")]
2013-02-27 04:19:22 +01:00
public void should_not_allow_if_quality_is_not_defined_in_profile(Quality qualityType)
{
2012-10-14 02:36:16 +02:00
parseResult.Quality.Quality = qualityType;
2013-02-27 04:19:22 +01:00
parseResult.Series.QualityProfile.Allowed = new List<Quality> { Quality.DVD, Quality.HDTV720p, Quality.Bluray1080p };
Subject.IsSatisfiedBy(parseResult).Should().BeFalse();
}
}
}