You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
2.1 KiB
66 lines
2.1 KiB
12 years ago
|
using System.Collections.Generic;
|
||
12 years ago
|
using FizzWare.NBuilder;
|
||
|
using FluentAssertions;
|
||
|
using NUnit.Framework;
|
||
12 years ago
|
using NzbDrone.Core.IndexerSearch;
|
||
12 years ago
|
using NzbDrone.Core.Model;
|
||
12 years ago
|
using NzbDrone.Core.Test.Framework;
|
||
|
using NzbDrone.Core.Tv;
|
||
12 years ago
|
|
||
12 years ago
|
namespace NzbDrone.Core.Test.IndexerSearchTests.DailyEpisodeSearchTests
|
||
12 years ago
|
{
|
||
|
[TestFixture]
|
||
12 years ago
|
public class IndexerDailyEpisodeSearchFixture : CoreTest<DailyEpisodeSearch>
|
||
12 years ago
|
{
|
||
|
private Series _series;
|
||
|
private Episode _episode;
|
||
|
private EpisodeParseResult _episodeParseResult;
|
||
12 years ago
|
|
||
12 years ago
|
[SetUp]
|
||
|
public void Setup()
|
||
|
{
|
||
|
_series = Builder<Series>
|
||
|
.CreateNew()
|
||
|
.Build();
|
||
|
|
||
|
_episode = Builder<Episode>
|
||
|
.CreateNew()
|
||
12 years ago
|
.With(e => e.SeriesId = _series.Id)
|
||
12 years ago
|
.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;
|
||
|
|
||
12 years ago
|
Subject.IsEpisodeMatch(_series, new { Episode = _episode }, _episodeParseResult).Should().BeFalse();
|
||
12 years ago
|
}
|
||
|
|
||
|
[Test]
|
||
|
public void should_return_WrongEpisode_is_parseResult_airdate_doesnt_match_episode()
|
||
|
{
|
||
|
_episodeParseResult.AirDate = _episode.AirDate.Value.AddDays(-10);
|
||
|
|
||
12 years ago
|
Subject.IsEpisodeMatch(_series, new { Episode = _episode }, _episodeParseResult)
|
||
|
.Should()
|
||
|
.BeFalse();
|
||
12 years ago
|
}
|
||
|
|
||
|
[Test]
|
||
|
public void should_not_return_error_when_airDates_match()
|
||
|
{
|
||
12 years ago
|
Subject.IsEpisodeMatch(_series, new {Episode = _episode}, _episodeParseResult)
|
||
|
.Should().BeTrue();
|
||
12 years ago
|
}
|
||
|
}
|
||
|
}
|