2012-02-07 06:08:07 +01:00
|
|
|
|
// ReSharper disable RedundantUsingDirective
|
|
|
|
|
|
|
|
|
|
using System.Linq;
|
2012-10-14 02:36:16 +02:00
|
|
|
|
using FluentAssertions;
|
2012-02-07 06:08:07 +01:00
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
using NzbDrone.Core.Model;
|
|
|
|
|
using NzbDrone.Core.Providers.DecisionEngine;
|
|
|
|
|
using NzbDrone.Core.Repository.Quality;
|
|
|
|
|
using NzbDrone.Core.Test.Framework;
|
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.Test.ProviderTests.DecisionEngineTests
|
|
|
|
|
{
|
|
|
|
|
[TestFixture]
|
|
|
|
|
// ReSharper disable InconsistentNaming
|
|
|
|
|
public class QualityUpgradeSpecificationFixture : CoreTest
|
|
|
|
|
{
|
2012-10-14 02:36:16 +02:00
|
|
|
|
public static object[] IsUpgradeTestCases =
|
|
|
|
|
{
|
|
|
|
|
new object[] { QualityTypes.SDTV, false, QualityTypes.SDTV, true, QualityTypes.SDTV, true },
|
|
|
|
|
new object[] { QualityTypes.WEBDL, false, QualityTypes.WEBDL, true, QualityTypes.WEBDL, true },
|
|
|
|
|
new object[] { QualityTypes.SDTV, false, QualityTypes.SDTV, false, QualityTypes.SDTV, false },
|
|
|
|
|
new object[] { QualityTypes.SDTV, false, QualityTypes.DVD, true, QualityTypes.SDTV, false },
|
|
|
|
|
new object[] { QualityTypes.WEBDL, false, QualityTypes.HDTV, true, QualityTypes.Bluray720p, false },
|
|
|
|
|
new object[] { QualityTypes.WEBDL, false, QualityTypes.HDTV, true, QualityTypes.WEBDL, false },
|
|
|
|
|
new object[] { QualityTypes.WEBDL, false, QualityTypes.WEBDL, false, QualityTypes.WEBDL, false },
|
|
|
|
|
new object[] { QualityTypes.SDTV, false, QualityTypes.SDTV, true, QualityTypes.SDTV, true }
|
|
|
|
|
};
|
2012-02-07 06:08:07 +01:00
|
|
|
|
|
2012-10-14 02:36:16 +02:00
|
|
|
|
[Test, TestCaseSource("IsUpgradeTestCases")]
|
|
|
|
|
public void IsUpgradeTest(QualityTypes current, bool currentProper, QualityTypes newQuality, bool newProper, QualityTypes cutoff, bool expected)
|
2012-02-07 06:08:07 +01:00
|
|
|
|
{
|
2012-10-14 02:36:16 +02:00
|
|
|
|
new QualityUpgradeSpecification().IsSatisfiedBy(new QualityModel(current, currentProper), new QualityModel(newQuality, newProper), cutoff)
|
|
|
|
|
.Should().Be(expected);
|
2012-02-07 06:08:07 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|