using System; using System.Collections.Generic; using System.Linq; using FizzWare.NBuilder; using FluentAssertions; using Moq; using NUnit.Framework; using NzbDrone.Core.DecisionEngine; using NzbDrone.Core.Tv; 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 _episodes; private EpisodeParseResult _episodeParseResult; private SearchHistoryItem _searchHistoryItem; [SetUp] public void Setup() { _series = Builder .CreateNew() .Build(); _episodes = Builder .CreateListOfSize(10) .All() .With(e => e.SeriesId = _series.Id) .With(e => e.Series = _series) .Build() .ToList(); _episodeParseResult = Builder .CreateNew() .With(p => p.SeasonNumber = 1) .Build(); _searchHistoryItem = new SearchHistoryItem(); } [Test] public void should_return_wrongSeason_when_season_does_not_match() { Mocker.Resolve() .CheckReport(_series, new { SeasonNumber = 2, Episodes = _episodes }, _episodeParseResult, _searchHistoryItem) .SearchError.Should().Be(ReportRejectionReasons.WrongSeason); } [Test] public void should_not_return_error_when_season_matches() { Mocker.Resolve() .CheckReport(_series, new { SeasonNumber = 1, Episodes = _episodes }, _episodeParseResult, _searchHistoryItem) .SearchError.Should().Be(ReportRejectionReasons.None); } } }