|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using FizzWare.NBuilder;
|
|
|
|
|
using FluentAssertions;
|
|
|
|
|
using NUnit.Framework;
|
|
|
|
@ -19,7 +20,8 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeRepositoryTests
|
|
|
|
|
private Series _unmonitoredSeries;
|
|
|
|
|
private PagingSpec<Episode> _pagingSpec;
|
|
|
|
|
private List<QualitiesBelowCutoff> _qualitiesBelowCutoff;
|
|
|
|
|
|
|
|
|
|
private List<Episode> _unairedEpisodes;
|
|
|
|
|
|
|
|
|
|
[SetUp]
|
|
|
|
|
public void Setup()
|
|
|
|
|
{
|
|
|
|
@ -108,18 +110,18 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeRepositoryTests
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var unairedEpisodes = Builder<Episode>.CreateListOfSize(1)
|
|
|
|
|
_unairedEpisodes = Builder<Episode>.CreateListOfSize(1)
|
|
|
|
|
.All()
|
|
|
|
|
.With(e => e.Id = 0)
|
|
|
|
|
.With(e => e.SeriesId = _monitoredSeries.Id)
|
|
|
|
|
.With(e => e.AirDateUtc = DateTime.Now.AddDays(5))
|
|
|
|
|
.With(e => e.Monitored = true)
|
|
|
|
|
.With(e => e.EpisodeFileId = qualityUnmet.Id)
|
|
|
|
|
.Build();
|
|
|
|
|
.Build()
|
|
|
|
|
.ToList();
|
|
|
|
|
|
|
|
|
|
Db.InsertMany(monitoredSeriesEpisodes);
|
|
|
|
|
Db.InsertMany(unmonitoredSeriesEpisodes);
|
|
|
|
|
Db.InsertMany(unairedEpisodes);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void GivenMonitoredFilterExpression()
|
|
|
|
@ -164,5 +166,18 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeRepositoryTests
|
|
|
|
|
spec.Records.Should().HaveCount(1);
|
|
|
|
|
spec.Records.Should().OnlyContain(e => e.Series.Monitored);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_contain_unaired_episodes_if_file_does_not_meet_cutoff()
|
|
|
|
|
{
|
|
|
|
|
Db.InsertMany(_unairedEpisodes);
|
|
|
|
|
|
|
|
|
|
GivenMonitoredFilterExpression();
|
|
|
|
|
|
|
|
|
|
var spec = Subject.EpisodesWhereCutoffUnmet(_pagingSpec, _qualitiesBelowCutoff, false);
|
|
|
|
|
|
|
|
|
|
spec.Records.Should().HaveCount(2);
|
|
|
|
|
spec.Records.Should().OnlyContain(e => e.Series.Monitored);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|