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