1
0
Fork 0
mirror of https://github.com/Radarr/Radarr synced 2024-12-25 01:11:43 +00:00

Added tests to attempt to find bug with WEBDL1080

This commit is contained in:
Mark McDowall 2012-12-13 08:43:25 -08:00
parent 02dad98000
commit 5294928878
7 changed files with 33 additions and 8 deletions

View file

@ -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" />

View file

@ -71,6 +71,7 @@ public class ParserTest : CoreTest
[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);

View file

@ -70,6 +70,7 @@ public class QualityParserTests : CoreTest
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 =

View file

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

View file

@ -23,7 +23,8 @@ public class QualityUpgradeSpecificationFixture : CoreTest
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")]

View file

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

View file

@ -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 @@ public class UpgradeHistorySpecificationFixtrue : CoreTest
private EpisodeParseResult parseResultSingle;
private QualityModel firstQuality;
private QualityModel secondQuality;
private Series fakeSeries;
[SetUp]
public void Setup()
@ -38,7 +39,7 @@ public void Setup()
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 @@ public void should_be_not_upgradable_if_only_second_episodes_is_upgradable()
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();
}
}
}