sonarr-repo-only/NzbDrone.Core.Test/ProviderTests/SearchTests/PartialSeasonSearchTests/CheckReportFixture.cs

68 lines
2.2 KiB
C#
Raw Normal View History

2013-01-13 08:24:48 +00:00
using System;
using System.Collections.Generic;
using System.Linq;
using FizzWare.NBuilder;
using FluentAssertions;
using Moq;
using NUnit.Framework;
2013-03-06 20:30:53 +00:00
using NzbDrone.Core.DecisionEngine;
using NzbDrone.Core.Tv;
2013-01-13 08:24:48 +00:00
using NzbDrone.Core.Model;
using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Providers;
using NzbDrone.Core.Providers.Search;
using NzbDrone.Core.Repository;
using NzbDrone.Core.Repository.Search;
using NzbDrone.Test.Common;
namespace NzbDrone.Core.Test.ProviderTests.SearchTests.PartialSeasonSearchTests
{
[TestFixture]
public class CheckReportFixture : TestBase
{
private Series _series;
private List<Episode> _episodes;
private EpisodeParseResult _episodeParseResult;
private SearchHistoryItem _searchHistoryItem;
[SetUp]
public void Setup()
{
_series = Builder<Series>
.CreateNew()
.Build();
_episodes = Builder<Episode>
.CreateListOfSize(10)
.All()
.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();
_searchHistoryItem = new SearchHistoryItem();
}
[Test]
public void should_return_wrongSeason_when_season_does_not_match()
{
Mocker.Resolve<PartialSeasonSearch>()
.CheckReport(_series, new { SeasonNumber = 2, Episodes = _episodes }, _episodeParseResult, _searchHistoryItem)
2013-03-06 20:30:53 +00:00
.SearchError.Should().Be(ReportRejectionReasons.WrongSeason);
2013-01-13 08:24:48 +00:00
}
[Test]
public void should_not_return_error_when_season_matches()
{
Mocker.Resolve<PartialSeasonSearch>()
.CheckReport(_series, new { SeasonNumber = 1, Episodes = _episodes }, _episodeParseResult, _searchHistoryItem)
2013-03-06 20:30:53 +00:00
.SearchError.Should().Be(ReportRejectionReasons.None);
2013-01-13 08:24:48 +00:00
}
}
}