Added tests to attempt to find bug with WEBDL1080

pull/4/head
Mark McDowall 12 years ago
parent 02dad98000
commit 5294928878

@ -170,9 +170,9 @@
<Compile Include="ProviderTests\PlexProviderTest.cs" />
<Compile Include="ProviderTests\SeasonProviderTest.cs" />
<Compile Include="ProviderTests\DecisionEngineTests\RetentionSpecificationFixture.cs" />
<Compile Include="ProviderTests\DecisionEngineTests\QualityAllowedByProfileSpecificationFixtrue.cs" />
<Compile Include="ProviderTests\DecisionEngineTests\UpgradeHistorySpecificationFixtrue.cs" />
<Compile Include="ProviderTests\DecisionEngineTests\UpgradeDiskSpecificationFixtrue.cs" />
<Compile Include="ProviderTests\DecisionEngineTests\QualityAllowedByProfileSpecificationFixture.cs" />
<Compile Include="ProviderTests\DecisionEngineTests\UpgradeHistorySpecificationFixture.cs" />
<Compile Include="ProviderTests\DecisionEngineTests\UpgradeDiskSpecificationFixture.cs" />
<Compile Include="ProviderTests\DecisionEngineTests\QualityUpgradeSpecificationFixture.cs" />
<Compile Include="ProviderTests\DecisionEngineTests\UpgradePossibleSpecificationFixture.cs" />
<Compile Include="ProviderTests\DownloadClientTests\BlackholeProviderFixture.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);

@ -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 =

@ -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;

@ -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")]

@ -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();
}
}
}

@ -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<Series>.CreateNew()
fakeSeries = Builder<Series>.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<HistoryProvider>().Setup(c => c.GetBestQualityInHistory(fakeSeries.SeriesId, 12, 3)).Returns(firstQuality);
_upgradeHistory.IsSatisfiedBy(parseResultSingle).Should().BeFalse();
}
}
}
Loading…
Cancel
Save