mirror of
https://github.com/lidarr/Lidarr
synced 2024-12-27 01:57:21 +00:00
Fixed broken tests from merge
This commit is contained in:
parent
5bbe310af5
commit
73e82c2f69
2 changed files with 8 additions and 18 deletions
|
@ -169,15 +169,15 @@ public void import_file_with_no_episode_in_db_should_skip()
|
|||
var fakeSeries = Builder<Series>.CreateNew().Build();
|
||||
|
||||
//Mocks
|
||||
Mocker.GetMock<DiskProvider>(MockBehavior.Strict)
|
||||
.Setup(e => e.IsChildOfPath(fileName, fakeSeries.Path)).Returns(false);
|
||||
|
||||
With50MBFile();
|
||||
|
||||
Mocker.GetMock<MediaFileProvider>()
|
||||
.Setup(p => p.Exists(It.IsAny<String>()))
|
||||
.Returns(false);
|
||||
|
||||
Mocker.GetMock<DiskProvider>(MockBehavior.Strict)
|
||||
.Setup(e => e.IsChildOfPath(fileName, fakeSeries.Path)).Returns(false);
|
||||
|
||||
Mocker.GetMock<EpisodeProvider>()
|
||||
.Setup(c => c.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>()))
|
||||
.Returns(new List<Episode>());
|
||||
|
@ -406,6 +406,8 @@ public void should_set_parseResult_SceneSource_if_not_in_series_Path()
|
|||
|
||||
const string path = @"C:\Test\Unsorted TV\30 Rock\30.rock.s01e01.pilot.mkv";
|
||||
|
||||
With50MBFile();
|
||||
|
||||
Mocker.GetMock<EpisodeProvider>().Setup(s => s.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>()))
|
||||
.Returns(new List<Episode>());
|
||||
|
||||
|
@ -427,6 +429,8 @@ public void should_not_set_parseResult_SceneSource_if_in_series_Path()
|
|||
|
||||
const string path = @"C:\Test\TV\30 Rock\30.rock.s01e01.pilot.mkv";
|
||||
|
||||
With50MBFile();
|
||||
|
||||
Mocker.GetMock<EpisodeProvider>().Setup(s => s.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>()))
|
||||
.Returns(new List<Episode>());
|
||||
|
||||
|
|
|
@ -7,20 +7,8 @@ namespace NzbDrone.Core.Providers.DecisionEngine
|
|||
{
|
||||
public class CustomStartDateSpecification
|
||||
{
|
||||
private readonly EpisodeProvider _episodeProvider;
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
[Inject]
|
||||
public CustomStartDateSpecification(EpisodeProvider episodeProvider)
|
||||
{
|
||||
_episodeProvider = episodeProvider;
|
||||
}
|
||||
|
||||
public CustomStartDateSpecification()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual bool IsSatisfiedBy(EpisodeParseResult subject)
|
||||
{
|
||||
if (!subject.Series.CustomStartDate.HasValue)
|
||||
|
@ -29,9 +17,7 @@ public virtual bool IsSatisfiedBy(EpisodeParseResult subject)
|
|||
return true;
|
||||
}
|
||||
|
||||
var episodes = _episodeProvider.GetEpisodesByParseResult(subject);
|
||||
|
||||
if (episodes.Any(episode => episode.AirDate >= subject.Series.CustomStartDate.Value))
|
||||
if (subject.Episodes.Any(episode => episode.AirDate >= subject.Series.CustomStartDate.Value))
|
||||
{
|
||||
logger.Debug("One or more episodes aired after cutoff, downloading.");
|
||||
return true;
|
||||
|
|
Loading…
Reference in a new issue