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.
117 lines
3.8 KiB
117 lines
3.8 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.Tv;
|
||
12 years ago
|
using NzbDrone.Test.Common;
|
||
|
|
||
12 years ago
|
namespace NzbDrone.Core.Test.IndexerSearchTests.EpisodeSearchTests
|
||
12 years ago
|
{
|
||
|
[TestFixture]
|
||
12 years ago
|
public class IndexerEpisodeSearch_EpisodeMatch : TestBase
|
||
12 years ago
|
{
|
||
|
private Series _series;
|
||
|
private Episode _episode;
|
||
|
private EpisodeParseResult _episodeParseResult;
|
||
|
|
||
|
[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.SeasonNumber = 1)
|
||
|
.With(p => p.EpisodeNumbers = new List<int>{ _episode.EpisodeNumber })
|
||
|
.With(p => p.Episodes = new List<Episode> { _episode })
|
||
|
.With(p => p.Series = _series)
|
||
|
.Build();
|
||
|
|
||
|
}
|
||
|
|
||
|
[Test]
|
||
|
public void should_return_WrongSeason_when_season_doesnt_match()
|
||
|
{
|
||
|
_episode.SeasonNumber = 10;
|
||
|
|
||
|
Mocker.Resolve<EpisodeSearch>()
|
||
12 years ago
|
.IsEpisodeMatch(_series, new {Episode = _episode}, _episodeParseResult)
|
||
12 years ago
|
.Should()
|
||
12 years ago
|
.BeFalse();
|
||
12 years ago
|
}
|
||
|
|
||
|
[Test]
|
||
|
public void should_return_WrongEpisode_when_episode_doesnt_match()
|
||
|
{
|
||
|
_episode.EpisodeNumber = 10;
|
||
|
|
||
|
Mocker.Resolve<EpisodeSearch>()
|
||
12 years ago
|
.IsEpisodeMatch(_series, new { Episode = _episode }, _episodeParseResult)
|
||
12 years ago
|
.Should()
|
||
12 years ago
|
.BeFalse();
|
||
12 years ago
|
}
|
||
|
|
||
|
[Test]
|
||
|
public void should_not_return_error_when_season_and_episode_match()
|
||
|
{
|
||
|
Mocker.Resolve<EpisodeSearch>()
|
||
12 years ago
|
.IsEpisodeMatch(_series, new { Episode = _episode }, _episodeParseResult)
|
||
12 years ago
|
.Should()
|
||
12 years ago
|
.BeTrue();
|
||
12 years ago
|
}
|
||
|
|
||
|
[Test]
|
||
|
public void should_return_WrongSeason_when_season_doesnt_match_for_scene_series()
|
||
|
{
|
||
|
_series.UseSceneNumbering = true;
|
||
|
_episode.SceneSeasonNumber = 10;
|
||
|
_episode.SeasonNumber = 10;
|
||
|
_episode.EpisodeNumber = 10;
|
||
|
|
||
|
Mocker.Resolve<EpisodeSearch>()
|
||
12 years ago
|
.IsEpisodeMatch(_series, new { Episode = _episode }, _episodeParseResult)
|
||
|
.Should()
|
||
|
.BeFalse();
|
||
12 years ago
|
}
|
||
|
|
||
|
[Test]
|
||
|
public void should_return_WrongEpisode_when_episode_doesnt_match_for_scene_series()
|
||
|
{
|
||
|
_series.UseSceneNumbering = true;
|
||
|
_episode.SceneEpisodeNumber = 10;
|
||
|
_episode.SeasonNumber = 10;
|
||
|
_episode.EpisodeNumber = 10;
|
||
|
|
||
|
Mocker.Resolve<EpisodeSearch>()
|
||
12 years ago
|
.IsEpisodeMatch(_series, new { Episode = _episode }, _episodeParseResult)
|
||
|
.Should()
|
||
|
.BeFalse();
|
||
12 years ago
|
}
|
||
|
|
||
|
[Test]
|
||
|
public void should_not_return_error_when_season_and_episode_match_for_scene_series()
|
||
|
{
|
||
|
_series.UseSceneNumbering = true;
|
||
|
_episode.SceneSeasonNumber = _episode.SeasonNumber;
|
||
|
_episode.SceneEpisodeNumber = _episode.EpisodeNumber;
|
||
|
_episode.SeasonNumber = 10;
|
||
|
_episode.EpisodeNumber = 10;
|
||
|
|
||
|
Mocker.Resolve<EpisodeSearch>()
|
||
12 years ago
|
.IsEpisodeMatch(_series, new { Episode = _episode }, _episodeParseResult)
|
||
12 years ago
|
.Should()
|
||
12 years ago
|
.BeTrue();
|
||
12 years ago
|
}
|
||
|
}
|
||
|
}
|