mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 21:43:33 -07:00
GetBestQualityInHistory will be handled in memory now
This commit is contained in:
parent
aea80870d3
commit
30a24fd0b4
3 changed files with 5 additions and 85 deletions
|
@ -30,78 +30,5 @@ namespace NzbDrone.Core.Test.HistoryTests
|
|||
AllStoredModels.Should().HaveCount(10);
|
||||
AllStoredModels.Should().OnlyContain(s => s.Date > DateTime.Now.AddDays(-30));
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void GetBestQualityInHistory_no_result()
|
||||
{
|
||||
Subject.GetBestQualityInHistory(12).Should().Be(null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetBestQualityInHistory_single_result()
|
||||
{
|
||||
var series = Builder<Series>.CreateNew().Build();
|
||||
var episode = Builder<Episode>.CreateNew()
|
||||
.With(c => c.Series = series)
|
||||
.With(c => c.SeriesId = series.Id)
|
||||
.Build();
|
||||
|
||||
|
||||
|
||||
var history = Builder<History.History>.CreateNew()
|
||||
.With(c => c.Id = 0)
|
||||
.With(h => h.Quality = new QualityModel(Quality.Bluray720p, true))
|
||||
.With(h => h.EpisodeId = episode.Id)
|
||||
.Build();
|
||||
|
||||
Db.Insert(history);
|
||||
|
||||
var result = Subject.GetBestQualityInHistory(episode.Id);
|
||||
|
||||
result.Should().NotBeNull();
|
||||
result.Quality.Should().Be(Quality.Bluray720p);
|
||||
result.Proper.Should().BeTrue();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetBestQualityInHistory_should_return_highest_result()
|
||||
{
|
||||
|
||||
var series = Builder<Series>.CreateNew().Build();
|
||||
var episode = Builder<Episode>.CreateNew()
|
||||
.With(c => c.Series = series)
|
||||
.With(c => c.SeriesId = series.Id)
|
||||
.Build();
|
||||
|
||||
|
||||
var history = Builder<History.History>
|
||||
.CreateListOfSize(5)
|
||||
.All()
|
||||
.With(c => c.Id = 0)
|
||||
.With(h => h.EpisodeId = episode.Id)
|
||||
.TheFirst(1)
|
||||
.With(h => h.Quality = new QualityModel(Quality.DVD, true))
|
||||
.TheNext(1)
|
||||
.With(h => h.Quality = new QualityModel(Quality.Bluray720p, true))
|
||||
.TheNext(1)
|
||||
.With(h => h.Quality = new QualityModel(Quality.Bluray720p, true))
|
||||
.TheNext(1)
|
||||
.With(h => h.Quality = new QualityModel(Quality.Bluray720p, false))
|
||||
.TheNext(1)
|
||||
.With(h => h.Quality = new QualityModel(Quality.SDTV, true))
|
||||
.Build();
|
||||
|
||||
Db.InsertMany(history);
|
||||
|
||||
var result = Subject.GetBestQualityInHistory(episode.Id);
|
||||
|
||||
result.Should().NotBeNull();
|
||||
result.Quality.Should().Be(Quality.Bluray720p);
|
||||
result.Proper.Should().BeTrue();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue