Added Download decision comparator test to confirm quality is preferred over seeders
This commit is contained in:
parent
f7e3d9b4c2
commit
5518cf5362
|
@ -379,5 +379,34 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
|||
var qualifiedReports = Subject.PrioritizeDecisions(decisions);
|
||||
qualifiedReports.First().RemoteEpisode.Release.Should().Be(remoteEpisode1.Release);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_prefer_quality_over_the_number_of_peers()
|
||||
{
|
||||
var remoteEpisode1 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.Bluray1080p));
|
||||
var remoteEpisode2 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.SDTV));
|
||||
|
||||
var torrentInfo1 = new TorrentInfo();
|
||||
torrentInfo1.PublishDate = DateTime.Now;
|
||||
torrentInfo1.DownloadProtocol = DownloadProtocol.Torrent;
|
||||
torrentInfo1.Seeders = 100;
|
||||
torrentInfo1.Peers = 10;
|
||||
torrentInfo1.Size = 200.Megabytes();
|
||||
|
||||
var torrentInfo2 = torrentInfo1.JsonClone();
|
||||
torrentInfo2.Seeders = 1100;
|
||||
torrentInfo2.Peers = 10;
|
||||
torrentInfo1.Size = 250.Megabytes();
|
||||
|
||||
remoteEpisode1.Release = torrentInfo1;
|
||||
remoteEpisode2.Release = torrentInfo2;
|
||||
|
||||
var decisions = new List<DownloadDecision>();
|
||||
decisions.Add(new DownloadDecision(remoteEpisode1));
|
||||
decisions.Add(new DownloadDecision(remoteEpisode2));
|
||||
|
||||
var qualifiedReports = Subject.PrioritizeDecisions(decisions);
|
||||
((TorrentInfo)qualifiedReports.First().RemoteEpisode.Release).Should().Be(torrentInfo1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue