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