2013-03-07 03:45:36 +00:00
|
|
|
using System.Collections.Generic;
|
2013-01-13 08:24:48 +00:00
|
|
|
using System.Linq;
|
|
|
|
using FizzWare.NBuilder;
|
|
|
|
using FluentAssertions;
|
|
|
|
using NUnit.Framework;
|
2013-03-07 03:45:36 +00:00
|
|
|
using NzbDrone.Core.IndexerSearch;
|
2013-01-13 08:24:48 +00:00
|
|
|
using NzbDrone.Core.Model;
|
2013-03-27 03:44:52 +00:00
|
|
|
using NzbDrone.Core.Test.Framework;
|
2013-03-07 03:45:36 +00:00
|
|
|
using NzbDrone.Core.Tv;
|
2013-01-13 08:24:48 +00:00
|
|
|
using NzbDrone.Test.Common;
|
|
|
|
|
2013-03-07 03:45:36 +00:00
|
|
|
namespace NzbDrone.Core.Test.IndexerSearchTests.PartialSeasonSearchTests
|
2013-01-13 08:24:48 +00:00
|
|
|
{
|
|
|
|
[TestFixture]
|
2013-03-27 03:44:52 +00:00
|
|
|
public class PartialSeasonSearch_EpisodeMatch : CoreTest<PartialSeasonSearch>
|
2013-01-13 08:24:48 +00:00
|
|
|
{
|
|
|
|
private Series _series;
|
|
|
|
private List<Episode> _episodes;
|
|
|
|
private EpisodeParseResult _episodeParseResult;
|
2013-03-07 01:51:47 +00:00
|
|
|
|
2013-01-13 08:24:48 +00:00
|
|
|
[SetUp]
|
|
|
|
public void Setup()
|
|
|
|
{
|
|
|
|
_series = Builder<Series>
|
|
|
|
.CreateNew()
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
_episodes = Builder<Episode>
|
|
|
|
.CreateListOfSize(10)
|
|
|
|
.All()
|
2013-02-26 03:58:57 +00:00
|
|
|
.With(e => e.SeriesId = _series.Id)
|
2013-01-13 08:24:48 +00:00
|
|
|
.With(e => e.Series = _series)
|
|
|
|
.Build()
|
|
|
|
.ToList();
|
|
|
|
|
|
|
|
_episodeParseResult = Builder<EpisodeParseResult>
|
|
|
|
.CreateNew()
|
|
|
|
.With(p => p.SeasonNumber = 1)
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void should_return_wrongSeason_when_season_does_not_match()
|
|
|
|
{
|
2013-03-27 03:44:52 +00:00
|
|
|
Subject.IsEpisodeMatch(_series, new { SeasonNumber = 2, Episodes = _episodes }, _episodeParseResult)
|
2013-03-07 01:51:47 +00:00
|
|
|
.Should().BeFalse();
|
2013-01-13 08:24:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void should_not_return_error_when_season_matches()
|
|
|
|
{
|
2013-03-27 03:44:52 +00:00
|
|
|
Subject.IsEpisodeMatch(_series, new { SeasonNumber = 1, Episodes = _episodes }, _episodeParseResult)
|
|
|
|
.Should().BeTrue();
|
2013-01-13 08:24:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|