Added test to verify 'like' clause and fixed issue.

pull/6/head
Taloth Saldono 11 years ago
parent ec88286d57
commit eddfe67eb1

@ -29,7 +29,8 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeRepositoryTests
Items = new List<QualityProfileItem> Items = new List<QualityProfileItem>
{ {
new QualityProfileItem { Allowed = true, Quality = Quality.SDTV }, new QualityProfileItem { Allowed = true, Quality = Quality.SDTV },
new QualityProfileItem { Allowed = true, Quality = Quality.WEBDL480p } new QualityProfileItem { Allowed = true, Quality = Quality.WEBDL480p },
new QualityProfileItem { Allowed = true, Quality = Quality.RAWHD }
} }
}; };
@ -67,13 +68,15 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeRepositoryTests
var qualityMet = new EpisodeFile { Path = "a", Quality = new QualityModel { Quality = Quality.WEBDL480p } }; 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 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>(); MediaFileRepository fileRepository = Mocker.Resolve<MediaFileRepository>();
qualityMet = fileRepository.Insert(qualityMet); qualityMet = fileRepository.Insert(qualityMet);
qualityUnmet = fileRepository.Insert(qualityUnmet); qualityUnmet = fileRepository.Insert(qualityUnmet);
qualityRawHD = fileRepository.Insert(qualityRawHD);
var monitoredSeriesEpisodes = Builder<Episode>.CreateListOfSize(3) var monitoredSeriesEpisodes = Builder<Episode>.CreateListOfSize(4)
.All() .All()
.With(e => e.Id = 0) .With(e => e.Id = 0)
.With(e => e.SeriesId = _monitoredSeries.Id) .With(e => e.SeriesId = _monitoredSeries.Id)
@ -83,6 +86,8 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeRepositoryTests
.TheFirst(1) .TheFirst(1)
.With(e => e.Monitored = false) .With(e => e.Monitored = false)
.With(e => e.EpisodeFileId = qualityMet.Id) .With(e => e.EpisodeFileId = qualityMet.Id)
.TheNext(1)
.With(e => e.EpisodeFileId = qualityRawHD.Id)
.TheLast(1) .TheLast(1)
.With(e => e.SeasonNumber = 0) .With(e => e.SeasonNumber = 0)
.Build(); .Build();

@ -194,7 +194,7 @@ namespace NzbDrone.Core.Tv
{ {
foreach (var belowCutoff in profile.QualityIds) 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…
Cancel
Save