|
|
|
@ -1,10 +1,9 @@
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System;
|
|
|
|
|
using FluentAssertions;
|
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
using NzbDrone.Core.Configuration;
|
|
|
|
|
using NzbDrone.Core.Profiles;
|
|
|
|
|
using NzbDrone.Core.Qualities;
|
|
|
|
|
using NzbDrone.Core.Tv;
|
|
|
|
|
using NzbDrone.Core.DecisionEngine;
|
|
|
|
|
using NzbDrone.Core.Test.Framework;
|
|
|
|
|
|
|
|
|
@ -16,14 +15,14 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
|
|
|
|
{
|
|
|
|
|
public static object[] IsUpgradeTestCases =
|
|
|
|
|
{
|
|
|
|
|
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.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 }
|
|
|
|
|
new object[] { Quality.SDTV, 1, Quality.SDTV, 2, Quality.SDTV, true },
|
|
|
|
|
new object[] { Quality.WEBDL720p, 1, Quality.WEBDL720p, 2, Quality.WEBDL720p, true },
|
|
|
|
|
new object[] { Quality.SDTV, 1, Quality.SDTV, 1, Quality.SDTV, false },
|
|
|
|
|
new object[] { Quality.WEBDL720p, 1, Quality.HDTV720p, 2, Quality.Bluray720p, false },
|
|
|
|
|
new object[] { Quality.WEBDL720p, 1, Quality.HDTV720p, 2, Quality.WEBDL720p, false },
|
|
|
|
|
new object[] { Quality.WEBDL720p, 1, Quality.WEBDL720p, 1, Quality.WEBDL720p, false },
|
|
|
|
|
new object[] { Quality.SDTV, 1, Quality.SDTV, 2, Quality.SDTV, true },
|
|
|
|
|
new object[] { Quality.WEBDL1080p, 1, Quality.WEBDL1080p, 1, Quality.WEBDL1080p, false }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
[SetUp]
|
|
|
|
@ -40,13 +39,13 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test, TestCaseSource("IsUpgradeTestCases")]
|
|
|
|
|
public void IsUpgradeTest(Quality current, bool currentProper, Quality newQuality, bool newProper, Quality cutoff, bool expected)
|
|
|
|
|
public void IsUpgradeTest(Quality current, Int32 currentVersion, Quality newQuality, Int32 newVersion, Quality cutoff, Boolean expected)
|
|
|
|
|
{
|
|
|
|
|
GivenAutoDownloadPropers(true);
|
|
|
|
|
|
|
|
|
|
var profile = new Profile { Items = Qualities.QualityFixture.GetDefaultQualities() };
|
|
|
|
|
|
|
|
|
|
Subject.IsUpgradable(profile, new QualityModel(current, currentProper), new QualityModel(newQuality, newProper))
|
|
|
|
|
Subject.IsUpgradable(profile, new QualityModel(current, new Revision(version: currentVersion)), new QualityModel(newQuality, new Revision(version: newVersion)))
|
|
|
|
|
.Should().Be(expected);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -57,7 +56,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
|
|
|
|
|
|
|
|
|
var profile = new Profile { Items = Qualities.QualityFixture.GetDefaultQualities() };
|
|
|
|
|
|
|
|
|
|
Subject.IsUpgradable(profile, new QualityModel(Quality.DVD, true), new QualityModel(Quality.DVD, false))
|
|
|
|
|
Subject.IsUpgradable(profile, new QualityModel(Quality.DVD, new Revision(version: 2)), new QualityModel(Quality.DVD, new Revision(version: 1)))
|
|
|
|
|
.Should().BeFalse();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|