diff --git a/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj b/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj index f86daf36f..27be2f100 100644 --- a/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj +++ b/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj @@ -170,9 +170,9 @@ - - - + + + diff --git a/NzbDrone.Core.Test/ParserFixture/ParserTest.cs b/NzbDrone.Core.Test/ParserFixture/ParserTest.cs index 18d4a621a..d7f65f732 100644 --- a/NzbDrone.Core.Test/ParserFixture/ParserTest.cs +++ b/NzbDrone.Core.Test/ParserFixture/ParserTest.cs @@ -71,6 +71,7 @@ namespace NzbDrone.Core.Test.ParserFixture [TestCase("Falling_Skies_-_1x1_-_Live_and_Learn_[HDTV]", "Falling Skies", 1, 1)] [TestCase("Top Gear - 07x03 - 2005.11.70", "Top Gear", 7, 3)] [TestCase("Hatfields and McCoys 2012 Part 1 REPACK 720p HDTV x264 2HD", "Hatfields and McCoys 2012", 1, 1)] + [TestCase("Glee.S04E09.Swan.Song.1080p.WEB-DL.DD5.1.H.264-ECI", "Glee", 4, 9)] public void ParseTitle_single(string postTitle, string title, int seasonNumber, int episodeNumber) { var result = Parser.ParseTitle(postTitle); diff --git a/NzbDrone.Core.Test/ParserFixture/QualityParserTests.cs b/NzbDrone.Core.Test/ParserFixture/QualityParserTests.cs index beadf999a..7726ac4cb 100644 --- a/NzbDrone.Core.Test/ParserFixture/QualityParserTests.cs +++ b/NzbDrone.Core.Test/ParserFixture/QualityParserTests.cs @@ -70,6 +70,7 @@ namespace NzbDrone.Core.Test.ParserFixture new object[] { "Criminal.Minds.S08E01.1080p.WEB-DL.DD5.1.H264-NFHD", QualityTypes.WEBDL1080p, false }, new object[] { "Its.Always.Sunny.in.Philadelphia.S08E01.1080p.WEB-DL.proper.AAC2.0.H.264", QualityTypes.WEBDL1080p, true }, new object[] { "Two and a Half Men S10E03 1080p WEB DL DD5 1 H 264 REPACK NFHD", QualityTypes.WEBDL1080p, true }, + new object[] { "Glee.S04E09.Swan.Song.1080p.WEB-DL.DD5.1.H.264-ECI", QualityTypes.WEBDL1080p, false } }; public static object[] SelfQualityParserCases = diff --git a/NzbDrone.Core.Test/ProviderTests/DecisionEngineTests/QualityAllowedByProfileSpecificationFixtrue.cs b/NzbDrone.Core.Test/ProviderTests/DecisionEngineTests/QualityAllowedByProfileSpecificationFixture.cs similarity index 97% rename from NzbDrone.Core.Test/ProviderTests/DecisionEngineTests/QualityAllowedByProfileSpecificationFixtrue.cs rename to NzbDrone.Core.Test/ProviderTests/DecisionEngineTests/QualityAllowedByProfileSpecificationFixture.cs index 433af761b..2a47bfa9d 100644 --- a/NzbDrone.Core.Test/ProviderTests/DecisionEngineTests/QualityAllowedByProfileSpecificationFixtrue.cs +++ b/NzbDrone.Core.Test/ProviderTests/DecisionEngineTests/QualityAllowedByProfileSpecificationFixture.cs @@ -15,7 +15,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DecisionEngineTests { [TestFixture] // ReSharper disable InconsistentNaming - public class QualityAllowedByProfileSpecificationFixtrue : CoreTest + public class QualityAllowedByProfileSpecificationFixture : CoreTest { private QualityAllowedByProfileSpecification _qualityAllowedByProfile; private EpisodeParseResult parseResult; diff --git a/NzbDrone.Core.Test/ProviderTests/DecisionEngineTests/QualityUpgradeSpecificationFixture.cs b/NzbDrone.Core.Test/ProviderTests/DecisionEngineTests/QualityUpgradeSpecificationFixture.cs index 07506badb..f6a7abb8b 100644 --- a/NzbDrone.Core.Test/ProviderTests/DecisionEngineTests/QualityUpgradeSpecificationFixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/DecisionEngineTests/QualityUpgradeSpecificationFixture.cs @@ -23,7 +23,8 @@ namespace NzbDrone.Core.Test.ProviderTests.DecisionEngineTests new object[] { QualityTypes.WEBDL720p, false, QualityTypes.HDTV, true, QualityTypes.Bluray720p, false }, new object[] { QualityTypes.WEBDL720p, false, QualityTypes.HDTV, true, QualityTypes.WEBDL720p, false }, new object[] { QualityTypes.WEBDL720p, false, QualityTypes.WEBDL720p, false, QualityTypes.WEBDL720p, false }, - new object[] { QualityTypes.SDTV, false, QualityTypes.SDTV, true, QualityTypes.SDTV, true } + new object[] { QualityTypes.SDTV, false, QualityTypes.SDTV, true, QualityTypes.SDTV, true }, + new object[] { QualityTypes.WEBDL1080p, false, QualityTypes.WEBDL1080p, false, QualityTypes.WEBDL1080p, false } }; [Test, TestCaseSource("IsUpgradeTestCases")] diff --git a/NzbDrone.Core.Test/ProviderTests/DecisionEngineTests/UpgradeDiskSpecificationFixtrue.cs b/NzbDrone.Core.Test/ProviderTests/DecisionEngineTests/UpgradeDiskSpecificationFixture.cs similarity index 90% rename from NzbDrone.Core.Test/ProviderTests/DecisionEngineTests/UpgradeDiskSpecificationFixtrue.cs rename to NzbDrone.Core.Test/ProviderTests/DecisionEngineTests/UpgradeDiskSpecificationFixture.cs index 74eddef0a..df017e25a 100644 --- a/NzbDrone.Core.Test/ProviderTests/DecisionEngineTests/UpgradeDiskSpecificationFixtrue.cs +++ b/NzbDrone.Core.Test/ProviderTests/DecisionEngineTests/UpgradeDiskSpecificationFixture.cs @@ -16,7 +16,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DecisionEngineTests { [TestFixture] // ReSharper disable InconsistentNaming - public class UpgradeDiskSpecificationFixtrue : CoreTest + public class UpgradeDiskSpecificationFixture : CoreTest { private UpgradeDiskSpecification _upgradeDisk; @@ -112,5 +112,14 @@ namespace NzbDrone.Core.Test.ProviderTests.DecisionEngineTests WithSecondFileUpgradable(); _upgradeDisk.IsSatisfiedBy(parseResultMulti).Should().BeFalse(); } + + [Test] + public void should_not_be_upgradable_if_qualities_are_the_same() + { + firstFile.Quality = QualityTypes.WEBDL1080p; + firstFile.Proper = false; + parseResultSingle.Quality = new QualityModel(QualityTypes.WEBDL1080p, false); + _upgradeDisk.IsSatisfiedBy(parseResultSingle).Should().BeFalse(); + } } } \ No newline at end of file diff --git a/NzbDrone.Core.Test/ProviderTests/DecisionEngineTests/UpgradeHistorySpecificationFixtrue.cs b/NzbDrone.Core.Test/ProviderTests/DecisionEngineTests/UpgradeHistorySpecificationFixture.cs similarity index 85% rename from NzbDrone.Core.Test/ProviderTests/DecisionEngineTests/UpgradeHistorySpecificationFixtrue.cs rename to NzbDrone.Core.Test/ProviderTests/DecisionEngineTests/UpgradeHistorySpecificationFixture.cs index 898585aac..565ea6ed4 100644 --- a/NzbDrone.Core.Test/ProviderTests/DecisionEngineTests/UpgradeHistorySpecificationFixtrue.cs +++ b/NzbDrone.Core.Test/ProviderTests/DecisionEngineTests/UpgradeHistorySpecificationFixture.cs @@ -16,7 +16,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DecisionEngineTests { [TestFixture] // ReSharper disable InconsistentNaming - public class UpgradeHistorySpecificationFixtrue : CoreTest + public class UpgradeHistorySpecificationFixture : CoreTest { private UpgradeHistorySpecification _upgradeHistory; @@ -24,6 +24,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DecisionEngineTests private EpisodeParseResult parseResultSingle; private QualityModel firstQuality; private QualityModel secondQuality; + private Series fakeSeries; [SetUp] public void Setup() @@ -38,7 +39,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DecisionEngineTests new Episode { SeasonNumber = 12, EpisodeNumber = 5 } }; - var fakeSeries = Builder.CreateNew() + fakeSeries = Builder.CreateNew() .With(c => c.QualityProfile = new QualityProfile { Cutoff = QualityTypes.Bluray1080p }) .Build(); @@ -113,5 +114,17 @@ namespace NzbDrone.Core.Test.ProviderTests.DecisionEngineTests WithSecondReportUpgradable(); _upgradeHistory.IsSatisfiedBy(parseResultMulti).Should().BeFalse(); } + + [Test] + public void should_not_be_upgradable_if_episode_is_of_same_quality_as_existing() + { + fakeSeries.QualityProfile = new QualityProfile { Cutoff = QualityTypes.WEBDL1080p }; + parseResultSingle.Quality = new QualityModel(QualityTypes.WEBDL1080p, false); + firstQuality = new QualityModel(QualityTypes.WEBDL1080p, false); + + Mocker.GetMock().Setup(c => c.GetBestQualityInHistory(fakeSeries.SeriesId, 12, 3)).Returns(firstQuality); + + _upgradeHistory.IsSatisfiedBy(parseResultSingle).Should().BeFalse(); + } } } \ No newline at end of file