2013-03-07 06:45:36 +03:00
|
|
|
using System.Collections.Generic;
|
2013-01-13 11:24:48 +03:00
|
|
|
using FizzWare.NBuilder;
|
|
|
|
using FluentAssertions;
|
|
|
|
using NUnit.Framework;
|
2013-03-07 06:45:36 +03:00
|
|
|
using NzbDrone.Core.IndexerSearch;
|
2013-01-13 11:24:48 +03:00
|
|
|
using NzbDrone.Core.Model;
|
2013-03-07 06:45:36 +03:00
|
|
|
using NzbDrone.Core.Test.Framework;
|
|
|
|
using NzbDrone.Core.Tv;
|
2013-01-13 11:24:48 +03:00
|
|
|
|
2013-03-07 06:45:36 +03:00
|
|
|
namespace NzbDrone.Core.Test.IndexerSearchTests.DailyEpisodeSearchTests
|
2013-01-13 11:24:48 +03:00
|
|
|
{
|
|
|
|
[TestFixture]
|
2013-03-07 06:45:36 +03:00
|
|
|
public class IndexerDailyEpisodeSearchFixture : CoreTest<DailyEpisodeSearch>
|
2013-01-13 11:24:48 +03:00
|
|
|
{
|
|
|
|
private Series _series;
|
|
|
|
private Episode _episode;
|
|
|
|
private EpisodeParseResult _episodeParseResult;
|
2013-03-07 04:51:47 +03:00
|
|
|
|
2013-01-13 11:24:48 +03:00
|
|
|
[SetUp]
|
|
|
|
public void Setup()
|
|
|
|
{
|
|
|
|
_series = Builder<Series>
|
|
|
|
.CreateNew()
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
_episode = Builder<Episode>
|
|
|
|
.CreateNew()
|
2013-02-26 06:58:57 +03:00
|
|
|
.With(e => e.SeriesId = _series.Id)
|
2013-01-13 11:24:48 +03:00
|
|
|
.With(e => e.Series = _series)
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
_episodeParseResult = Builder<EpisodeParseResult>
|
|
|
|
.CreateNew()
|
|
|
|
.With(p => p.AirDate = _episode.AirDate)
|
|
|
|
.With(p => p.Episodes = new List<Episode> { _episode })
|
|
|
|
.With(p => p.Series = _series)
|
|
|
|
.Build();
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void should_return_WrongEpisode_is_parseResult_doesnt_have_airdate()
|
|
|
|
{
|
|
|
|
_episodeParseResult.AirDate = null;
|
|
|
|
|
2013-03-07 06:45:36 +03:00
|
|
|
Subject.IsEpisodeMatch(_series, new { Episode = _episode }, _episodeParseResult).Should().BeFalse();
|
2013-01-13 11:24:48 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void should_return_WrongEpisode_is_parseResult_airdate_doesnt_match_episode()
|
|
|
|
{
|
|
|
|
_episodeParseResult.AirDate = _episode.AirDate.Value.AddDays(-10);
|
|
|
|
|
2013-03-07 06:45:36 +03:00
|
|
|
Subject.IsEpisodeMatch(_series, new { Episode = _episode }, _episodeParseResult)
|
|
|
|
.Should()
|
|
|
|
.BeFalse();
|
2013-01-13 11:24:48 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void should_not_return_error_when_airDates_match()
|
|
|
|
{
|
2013-03-07 06:45:36 +03:00
|
|
|
Subject.IsEpisodeMatch(_series, new {Episode = _episode}, _episodeParseResult)
|
|
|
|
.Should().BeTrue();
|
2013-01-13 11:24:48 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|