mirror of
https://github.com/Sonarr/Sonarr
synced 2025-02-25 15:33:11 +00:00
Added test to verify 'like' clause and fixed issue.
This commit is contained in:
parent
ec88286d57
commit
eddfe67eb1
2 changed files with 10 additions and 5 deletions
|
@ -28,8 +28,9 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeRepositoryTests
|
|||
Cutoff = Quality.WEBDL480p,
|
||||
Items = new List<QualityProfileItem>
|
||||
{
|
||||
new QualityProfileItem { Allowed = true, Quality = Quality.SDTV },
|
||||
new QualityProfileItem { Allowed = true, Quality = Quality.WEBDL480p }
|
||||
new QualityProfileItem { Allowed = true, Quality = Quality.SDTV },
|
||||
new QualityProfileItem { Allowed = true, Quality = Quality.WEBDL480p },
|
||||
new QualityProfileItem { Allowed = true, Quality = Quality.RAWHD }
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -64,16 +65,18 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeRepositoryTests
|
|||
{
|
||||
new QualitiesBelowCutoff(qualityProfile.Id, new[] {Quality.SDTV.Id})
|
||||
};
|
||||
|
||||
|
||||
var qualityMet = new EpisodeFile { Path = "a", Quality = new QualityModel { Quality = Quality.WEBDL480p } };
|
||||
var qualityUnmet = new EpisodeFile { Path = "b", Quality = new QualityModel { Quality = Quality.SDTV } };
|
||||
var qualityRawHD = new EpisodeFile { Path = "c", Quality = new QualityModel { Quality = Quality.RAWHD } };
|
||||
|
||||
MediaFileRepository fileRepository = Mocker.Resolve<MediaFileRepository>();
|
||||
|
||||
qualityMet = fileRepository.Insert(qualityMet);
|
||||
qualityUnmet = fileRepository.Insert(qualityUnmet);
|
||||
qualityRawHD = fileRepository.Insert(qualityRawHD);
|
||||
|
||||
var monitoredSeriesEpisodes = Builder<Episode>.CreateListOfSize(3)
|
||||
var monitoredSeriesEpisodes = Builder<Episode>.CreateListOfSize(4)
|
||||
.All()
|
||||
.With(e => e.Id = 0)
|
||||
.With(e => e.SeriesId = _monitoredSeries.Id)
|
||||
|
@ -83,6 +86,8 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeRepositoryTests
|
|||
.TheFirst(1)
|
||||
.With(e => e.Monitored = false)
|
||||
.With(e => e.EpisodeFileId = qualityMet.Id)
|
||||
.TheNext(1)
|
||||
.With(e => e.EpisodeFileId = qualityRawHD.Id)
|
||||
.TheLast(1)
|
||||
.With(e => e.SeasonNumber = 0)
|
||||
.Build();
|
||||
|
|
|
@ -194,7 +194,7 @@ namespace NzbDrone.Core.Tv
|
|||
{
|
||||
foreach (var belowCutoff in profile.QualityIds)
|
||||
{
|
||||
clauses.Add(String.Format("([t1].[QualityProfileId] = {0} AND [t2].[Quality] LIKE '%_quality_:%{1}%')", profile.ProfileId, belowCutoff));
|
||||
clauses.Add(String.Format("([t1].[QualityProfileId] = {0} AND [t2].[Quality] LIKE '%_quality_: {1},%')", profile.ProfileId, belowCutoff));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue