|
|
|
@ -6,7 +6,6 @@ using FluentAssertions;
|
|
|
|
|
using Moq;
|
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
using NzbDrone.Core.MetadataSource;
|
|
|
|
|
using NzbDrone.Core.MetadataSource.Tvdb;
|
|
|
|
|
using NzbDrone.Core.Tv;
|
|
|
|
|
using NzbDrone.Core.Test.Framework;
|
|
|
|
|
using NzbDrone.Test.Common;
|
|
|
|
@ -73,13 +72,6 @@ namespace NzbDrone.Core.Test.TvTests
|
|
|
|
|
.Callback<List<Episode>>(e => _deletedEpisodes = e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void GivenAnimeEpisodes(List<Episode> episodes)
|
|
|
|
|
{
|
|
|
|
|
Mocker.GetMock<ITvdbProxy>()
|
|
|
|
|
.Setup(s => s.GetEpisodeInfo(It.IsAny<Int32>()))
|
|
|
|
|
.Returns(episodes);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_create_all_when_no_existing_episodes()
|
|
|
|
|
{
|
|
|
|
@ -175,22 +167,10 @@ namespace NzbDrone.Core.Test.TvTests
|
|
|
|
|
_deletedEpisodes.Should().BeEmpty();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_not_set_absolute_episode_number_for_non_anime()
|
|
|
|
|
{
|
|
|
|
|
Mocker.GetMock<IEpisodeService>().Setup(c => c.GetEpisodeBySeries(It.IsAny<Int32>()))
|
|
|
|
|
.Returns(new List<Episode>());
|
|
|
|
|
|
|
|
|
|
Subject.RefreshEpisodeInfo(GetSeries(), GetEpisodes());
|
|
|
|
|
|
|
|
|
|
_insertedEpisodes.All(e => !e.AbsoluteEpisodeNumber.HasValue).Should().BeTrue();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_set_absolute_episode_number_for_anime()
|
|
|
|
|
{
|
|
|
|
|
var episodes = Builder<Episode>.CreateListOfSize(3).Build().ToList();
|
|
|
|
|
GivenAnimeEpisodes(episodes);
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<IEpisodeService>().Setup(c => c.GetEpisodeBySeries(It.IsAny<Int32>()))
|
|
|
|
|
.Returns(new List<Episode>());
|
|
|
|
@ -206,7 +186,6 @@ namespace NzbDrone.Core.Test.TvTests
|
|
|
|
|
public void should_set_absolute_episode_number_even_if_not_previously_set_for_anime()
|
|
|
|
|
{
|
|
|
|
|
var episodes = Builder<Episode>.CreateListOfSize(3).Build().ToList();
|
|
|
|
|
GivenAnimeEpisodes(episodes);
|
|
|
|
|
|
|
|
|
|
var existingEpisodes = episodes.JsonClone();
|
|
|
|
|
existingEpisodes.ForEach(e => e.AbsoluteEpisodeNumber = null);
|
|
|
|
@ -234,8 +213,6 @@ namespace NzbDrone.Core.Test.TvTests
|
|
|
|
|
.With(e => e.AbsoluteEpisodeNumber = expectedAbsoluteNumber)
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
GivenAnimeEpisodes(new List<Episode> { episode });
|
|
|
|
|
|
|
|
|
|
var existingEpisode = episode.JsonClone();
|
|
|
|
|
existingEpisode.SeasonNumber = 1;
|
|
|
|
|
existingEpisode.EpisodeNumber = 1;
|
|
|
|
@ -265,8 +242,6 @@ namespace NzbDrone.Core.Test.TvTests
|
|
|
|
|
episodes[0].SeasonNumber.Should().NotBe(episodes[1].SeasonNumber);
|
|
|
|
|
episodes[0].EpisodeNumber.Should().NotBe(episodes[1].EpisodeNumber);
|
|
|
|
|
|
|
|
|
|
GivenAnimeEpisodes(episodes);
|
|
|
|
|
|
|
|
|
|
var existingEpisode = new Episode
|
|
|
|
|
{
|
|
|
|
|
SeasonNumber = episodes[0].SeasonNumber,
|
|
|
|
@ -297,8 +272,6 @@ namespace NzbDrone.Core.Test.TvTests
|
|
|
|
|
episodes[3].AbsoluteEpisodeNumber = null;
|
|
|
|
|
episodes[4].AbsoluteEpisodeNumber = null;
|
|
|
|
|
|
|
|
|
|
GivenAnimeEpisodes(episodes);
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<IEpisodeService>().Setup(c => c.GetEpisodeBySeries(It.IsAny<Int32>()))
|
|
|
|
|
.Returns(new List<Episode>());
|
|
|
|
|
|
|
|
|
|