|
|
|
@ -13,6 +13,7 @@ using NUnit.Framework;
|
|
|
|
|
using FluentAssertions;
|
|
|
|
|
using FizzWare.NBuilder;
|
|
|
|
|
using NzbDrone.Common.Extensions;
|
|
|
|
|
using NzbDrone.Core.Configuration;
|
|
|
|
|
using NzbDrone.Core.Test.Framework;
|
|
|
|
|
using NzbDrone.Core.Languages;
|
|
|
|
|
using NzbDrone.Core.Profiles.Languages;
|
|
|
|
@ -440,7 +441,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_put_higher_quality_before_lower_allways()
|
|
|
|
|
public void should_put_higher_quality_before_lower_always()
|
|
|
|
|
{
|
|
|
|
|
var remoteEpisode1 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.SDTV), Language.French);
|
|
|
|
|
var remoteEpisode2 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.HDTV720p), Language.German);
|
|
|
|
@ -452,5 +453,87 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
|
|
|
|
var qualifiedReports = Subject.PrioritizeDecisions(decisions);
|
|
|
|
|
qualifiedReports.First().RemoteEpisode.ParsedEpisodeInfo.Quality.Quality.Should().Be(Quality.HDTV720p);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_prefer_higher_score_over_lower_score()
|
|
|
|
|
{
|
|
|
|
|
var remoteEpisode1 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.WEBDL1080p), Language.English);
|
|
|
|
|
var remoteEpisode2 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.WEBDL1080p), Language.English);
|
|
|
|
|
|
|
|
|
|
remoteEpisode1.PreferredWordScore = 10;
|
|
|
|
|
remoteEpisode2.PreferredWordScore = 0;
|
|
|
|
|
|
|
|
|
|
var decisions = new List<DownloadDecision>();
|
|
|
|
|
decisions.Add(new DownloadDecision(remoteEpisode1));
|
|
|
|
|
decisions.Add(new DownloadDecision(remoteEpisode2));
|
|
|
|
|
|
|
|
|
|
var qualifiedReports = Subject.PrioritizeDecisions(decisions);
|
|
|
|
|
qualifiedReports.First().RemoteEpisode.PreferredWordScore.Should().Be(10);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_prefer_proper_over_score_when_download_propers_is_prefer_and_upgrade()
|
|
|
|
|
{
|
|
|
|
|
Mocker.GetMock<IConfigService>()
|
|
|
|
|
.Setup(s => s.DownloadPropersAndRepacks)
|
|
|
|
|
.Returns(ProperDownloadTypes.PreferAndUpgrade);
|
|
|
|
|
|
|
|
|
|
var remoteEpisode1 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.WEBDL1080p, new Revision(1)), Language.English);
|
|
|
|
|
var remoteEpisode2 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.WEBDL1080p, new Revision(2)), Language.English);
|
|
|
|
|
|
|
|
|
|
remoteEpisode1.PreferredWordScore = 10;
|
|
|
|
|
remoteEpisode2.PreferredWordScore = 0;
|
|
|
|
|
|
|
|
|
|
var decisions = new List<DownloadDecision>();
|
|
|
|
|
decisions.Add(new DownloadDecision(remoteEpisode1));
|
|
|
|
|
decisions.Add(new DownloadDecision(remoteEpisode2));
|
|
|
|
|
|
|
|
|
|
var qualifiedReports = Subject.PrioritizeDecisions(decisions);
|
|
|
|
|
qualifiedReports.First().RemoteEpisode.ParsedEpisodeInfo.Quality.Revision.Version.Should().Be(2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_prefer_proper_over_score_when_download_propers_is_do_not_upgrade()
|
|
|
|
|
{
|
|
|
|
|
Mocker.GetMock<IConfigService>()
|
|
|
|
|
.Setup(s => s.DownloadPropersAndRepacks)
|
|
|
|
|
.Returns(ProperDownloadTypes.DoNotUpgrade);
|
|
|
|
|
|
|
|
|
|
var remoteEpisode1 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.WEBDL1080p, new Revision(1)), Language.English);
|
|
|
|
|
var remoteEpisode2 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.WEBDL1080p, new Revision(2)), Language.English);
|
|
|
|
|
|
|
|
|
|
remoteEpisode1.PreferredWordScore = 10;
|
|
|
|
|
remoteEpisode2.PreferredWordScore = 0;
|
|
|
|
|
|
|
|
|
|
var decisions = new List<DownloadDecision>();
|
|
|
|
|
decisions.Add(new DownloadDecision(remoteEpisode1));
|
|
|
|
|
decisions.Add(new DownloadDecision(remoteEpisode2));
|
|
|
|
|
|
|
|
|
|
var qualifiedReports = Subject.PrioritizeDecisions(decisions);
|
|
|
|
|
qualifiedReports.First().RemoteEpisode.ParsedEpisodeInfo.Quality.Revision.Version.Should().Be(2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_prefer_score_over_proper_when_download_propers_is_do_not_prefer()
|
|
|
|
|
{
|
|
|
|
|
Mocker.GetMock<IConfigService>()
|
|
|
|
|
.Setup(s => s.DownloadPropersAndRepacks)
|
|
|
|
|
.Returns(ProperDownloadTypes.DoNotPrefer);
|
|
|
|
|
|
|
|
|
|
var remoteEpisode1 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.WEBDL1080p, new Revision(1)), Language.English);
|
|
|
|
|
var remoteEpisode2 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.WEBDL1080p, new Revision(2)), Language.English);
|
|
|
|
|
|
|
|
|
|
remoteEpisode1.PreferredWordScore = 10;
|
|
|
|
|
remoteEpisode2.PreferredWordScore = 0;
|
|
|
|
|
|
|
|
|
|
var decisions = new List<DownloadDecision>();
|
|
|
|
|
decisions.Add(new DownloadDecision(remoteEpisode1));
|
|
|
|
|
decisions.Add(new DownloadDecision(remoteEpisode2));
|
|
|
|
|
|
|
|
|
|
var qualifiedReports = Subject.PrioritizeDecisions(decisions);
|
|
|
|
|
qualifiedReports.First().RemoteEpisode.ParsedEpisodeInfo.Quality.Quality.Should().Be(Quality.WEBDL1080p);
|
|
|
|
|
qualifiedReports.First().RemoteEpisode.ParsedEpisodeInfo.Quality.Revision.Version.Should().Be(1);
|
|
|
|
|
qualifiedReports.First().RemoteEpisode.PreferredWordScore.Should().Be(10);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|