diff --git a/NzbDrone.Core.Test/ProviderTests/EpisodeProviderTest.cs b/NzbDrone.Core.Test/ProviderTests/EpisodeProviderTest.cs index 3ee535711..cd8db4ffb 100644 --- a/NzbDrone.Core.Test/ProviderTests/EpisodeProviderTest.cs +++ b/NzbDrone.Core.Test/ProviderTests/EpisodeProviderTest.cs @@ -1100,6 +1100,42 @@ public void IgnoreSeason_Ignore_Half() Mocker.VerifyAllMocks(); } + [Test] + public void IgnoreSeason_should_call_SetIgnore_in_season_provider_one_time_only() + { + WithRealDb(); + + var episodes = Builder.CreateListOfSize(4) + .All() + .With(c => c.SeriesId = 10) + .With(c => c.SeasonNumber = 1) + .With(c => c.Ignored = false) + .Build().ToList(); + + var season = new Season + { + SeriesId = 10, + SeasonNumber = 1, + Ignored = false + }; + + Db.Insert(season); + Db.InsertMany(episodes); + + Mocker.GetMock().Setup(s => s.SetIgnore(10, 1, true)).Verifiable(); + + //Act + Mocker.Resolve().SetSeasonIgnore(10, 1, true); + + //Assert + var episodesInDb = Db.Fetch(@"SELECT * FROM Episodes"); + + episodesInDb.Should().HaveCount(4); + episodesInDb.Where(e => e.Ignored).Should().HaveCount(4); + + Mocker.GetMock().Verify(s => s.SetIgnore(10, 1, true), Times.Once()); + } + [Test] public void EpisodesWithoutFiles_no_specials() {