Season 1, Episode 0 will not be automatically ignored (usually a pilot), with test.

pull/2/head
Mark McDowall 13 years ago
parent dfbb222c6c
commit 7ff53e5ac2

@ -1544,5 +1544,51 @@ namespace NzbDrone.Core.Test.ProviderTests
{
Mocker.Resolve<EpisodeProvider>().SetPostDownloadStatus(new List<int>(), PostDownloadStatusType.Failed);
}
[Test]
public void RefreshEpisodeInfo_should_ignore_episode_zero_except_if_season_one()
{
//Arrange
const int seriesId = 71663;
const int episodeCount = 5;
var tvdbSeries = Builder<TvdbSeries>.CreateNew().With(
c => c.Episodes =
new List<TvdbEpisode>(Builder<TvdbEpisode>.CreateListOfSize(episodeCount).
All()
.With(l => l.Language = new TvdbLanguage(0, "eng", "a"))
.With(e => e.EpisodeNumber = 0)
.TheFirst(1)
.With(e => e.SeasonNumber = 1)
.TheNext(1)
.With(e => e.SeasonNumber = 2)
.TheNext(1)
.With(e => e.SeasonNumber = 3)
.TheNext(1)
.With(e => e.SeasonNumber = 4)
.TheNext(1)
.With(e => e.SeasonNumber = 5)
.Build())
).With(c => c.Id = seriesId).Build();
var fakeSeries = Builder<Series>.CreateNew().With(c => c.SeriesId = seriesId).Build();
WithRealDb();
Db.Insert(fakeSeries);
Mocker.GetMock<TvDbProvider>()
.Setup(c => c.GetSeries(seriesId, true))
.Returns(tvdbSeries);
//Act
Mocker.Resolve<EpisodeProvider>().RefreshEpisodeInfo(fakeSeries);
//Assert
var result = Mocker.Resolve<EpisodeProvider>().GetEpisodeBySeries(seriesId).ToList();
result.Should().HaveCount(episodeCount);
result.Where(e => e.Ignored).Should().HaveCount(episodeCount - 1);
result.Single(e => e.SeasonNumber == 1).Ignored.Should().BeFalse();
}
}
}

@ -287,7 +287,7 @@ namespace NzbDrone.Core.Providers
newList.Add(episodeToUpdate);
//If it is Episode Zero Ignore it, since it is new
if (episode.EpisodeNumber == 0)
if (episode.EpisodeNumber == 0 && episode.SeasonNumber > 1)
{
episodeToUpdate.Ignored = true;
}

Loading…
Cancel
Save