From d0471d4811b1a0a1660df00e1586cfc878929a65 Mon Sep 17 00:00:00 2001 From: Stevie Robinson Date: Thu, 18 May 2023 09:40:18 +0200 Subject: [PATCH] add option for single int seriesId to avoid breaking change --- .../TvTests/RefreshSeriesServiceFixture.cs | 17 +++++++++++++++++ .../Tv/Commands/RefreshSeriesCommand.cs | 6 ++++++ 2 files changed, 23 insertions(+) diff --git a/src/NzbDrone.Core.Test/TvTests/RefreshSeriesServiceFixture.cs b/src/NzbDrone.Core.Test/TvTests/RefreshSeriesServiceFixture.cs index 7a154d5fa..c35eae9e2 100644 --- a/src/NzbDrone.Core.Test/TvTests/RefreshSeriesServiceFixture.cs +++ b/src/NzbDrone.Core.Test/TvTests/RefreshSeriesServiceFixture.cs @@ -74,6 +74,23 @@ namespace NzbDrone.Core.Test.TvTests .Verify(v => v.UpdateSeries(It.Is(s => s.Seasons.Count == 2 && s.Seasons.Single(season => season.SeasonNumber == 2).Monitored == true), It.IsAny(), It.IsAny())); } + [Test] + public void should_monitor_new_seasons_automatically_if_series_is_monitored_single_seriesId() + { + _series.Monitored = true; + var newSeriesInfo = _series.JsonClone(); + newSeriesInfo.Seasons.Add(Builder.CreateNew() + .With(s => s.SeasonNumber = 2) + .Build()); + + GivenNewSeriesInfo(newSeriesInfo); + + Subject.Execute(new RefreshSeriesCommand(_series.Id)); + + Mocker.GetMock() + .Verify(v => v.UpdateSeries(It.Is(s => s.Seasons.Count == 2 && s.Seasons.Single(season => season.SeasonNumber == 2).Monitored == true), It.IsAny(), It.IsAny())); + } + [Test] public void should_not_monitor_new_seasons_automatically_if_series_is_not_monitored() { diff --git a/src/NzbDrone.Core/Tv/Commands/RefreshSeriesCommand.cs b/src/NzbDrone.Core/Tv/Commands/RefreshSeriesCommand.cs index df140eae8..6d9a67bf3 100644 --- a/src/NzbDrone.Core/Tv/Commands/RefreshSeriesCommand.cs +++ b/src/NzbDrone.Core/Tv/Commands/RefreshSeriesCommand.cs @@ -6,6 +6,7 @@ namespace NzbDrone.Core.Tv.Commands { public class RefreshSeriesCommand : Command { + public int? SeriesId { get; set; } public List SeriesIds { get; set; } public bool IsNewSeries { get; set; } @@ -14,6 +15,11 @@ namespace NzbDrone.Core.Tv.Commands SeriesIds = new List(); } + public RefreshSeriesCommand(int seriesId, bool isNewSeries = false) + { + SeriesIds = new List { seriesId }; + } + public RefreshSeriesCommand(List seriesIds, bool isNewSeries = false) { SeriesIds = seriesIds;