2012-02-07 05:08:07 +00:00
|
|
|
|
// ReSharper disable RedundantUsingDirective
|
|
|
|
|
|
|
|
|
|
using System.Linq;
|
2012-10-14 00:36:16 +00:00
|
|
|
|
using FluentAssertions;
|
2012-02-07 05:08:07 +00:00
|
|
|
|
using NUnit.Framework;
|
2013-02-19 06:01:03 +00:00
|
|
|
|
using NzbDrone.Core.Tv;
|
2012-02-07 05:08:07 +00:00
|
|
|
|
using NzbDrone.Core.Model;
|
2013-02-19 02:19:38 +00:00
|
|
|
|
using NzbDrone.Core.DecisionEngine;
|
2012-02-07 05:08:07 +00:00
|
|
|
|
using NzbDrone.Core.Repository.Quality;
|
|
|
|
|
using NzbDrone.Core.Test.Framework;
|
|
|
|
|
|
2013-02-19 02:19:38 +00:00
|
|
|
|
namespace NzbDrone.Core.Test.DecisionEngineTests
|
2012-02-07 05:08:07 +00:00
|
|
|
|
{
|
|
|
|
|
[TestFixture]
|
|
|
|
|
// ReSharper disable InconsistentNaming
|
2013-02-17 05:44:06 +00:00
|
|
|
|
public class QualityUpgradeSpecificationFixture : CoreTest
|
2012-02-07 05:08:07 +00:00
|
|
|
|
{
|
2012-10-14 00:36:16 +00:00
|
|
|
|
public static object[] IsUpgradeTestCases =
|
|
|
|
|
{
|
|
|
|
|
new object[] { QualityTypes.SDTV, false, QualityTypes.SDTV, true, QualityTypes.SDTV, true },
|
2012-10-15 04:30:07 +00:00
|
|
|
|
new object[] { QualityTypes.WEBDL720p, false, QualityTypes.WEBDL720p, true, QualityTypes.WEBDL720p, true },
|
2012-10-14 00:36:16 +00:00
|
|
|
|
new object[] { QualityTypes.SDTV, false, QualityTypes.SDTV, false, QualityTypes.SDTV, false },
|
|
|
|
|
new object[] { QualityTypes.SDTV, false, QualityTypes.DVD, true, QualityTypes.SDTV, false },
|
2013-01-01 03:45:57 +00:00
|
|
|
|
new object[] { QualityTypes.WEBDL720p, false, QualityTypes.HDTV720p, true, QualityTypes.Bluray720p, false },
|
|
|
|
|
new object[] { QualityTypes.WEBDL720p, false, QualityTypes.HDTV720p, true, QualityTypes.WEBDL720p, false },
|
2012-10-15 04:30:07 +00:00
|
|
|
|
new object[] { QualityTypes.WEBDL720p, false, QualityTypes.WEBDL720p, false, QualityTypes.WEBDL720p, false },
|
2012-12-13 16:43:25 +00:00
|
|
|
|
new object[] { QualityTypes.SDTV, false, QualityTypes.SDTV, true, QualityTypes.SDTV, true },
|
|
|
|
|
new object[] { QualityTypes.WEBDL1080p, false, QualityTypes.WEBDL1080p, false, QualityTypes.WEBDL1080p, false }
|
2012-10-14 00:36:16 +00:00
|
|
|
|
};
|
2012-02-07 05:08:07 +00:00
|
|
|
|
|
2012-10-14 00:36:16 +00:00
|
|
|
|
[Test, TestCaseSource("IsUpgradeTestCases")]
|
|
|
|
|
public void IsUpgradeTest(QualityTypes current, bool currentProper, QualityTypes newQuality, bool newProper, QualityTypes cutoff, bool expected)
|
2012-02-07 05:08:07 +00:00
|
|
|
|
{
|
2012-10-14 00:36:16 +00:00
|
|
|
|
new QualityUpgradeSpecification().IsSatisfiedBy(new QualityModel(current, currentProper), new QualityModel(newQuality, newProper), cutoff)
|
|
|
|
|
.Should().Be(expected);
|
2012-02-07 05:08:07 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|