add option for single int seriesId to avoid breaking change

This commit is contained in:
Stevie Robinson 2023-05-18 09:40:18 +02:00
parent c8e23f9d2c
commit d0471d4811
2 changed files with 23 additions and 0 deletions

View File

@ -74,6 +74,23 @@ namespace NzbDrone.Core.Test.TvTests
.Verify(v => v.UpdateSeries(It.Is<Series>(s => s.Seasons.Count == 2 && s.Seasons.Single(season => season.SeasonNumber == 2).Monitored == true), It.IsAny<bool>(), It.IsAny<bool>()));
}
[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<Season>.CreateNew()
.With(s => s.SeasonNumber = 2)
.Build());
GivenNewSeriesInfo(newSeriesInfo);
Subject.Execute(new RefreshSeriesCommand(_series.Id));
Mocker.GetMock<ISeriesService>()
.Verify(v => v.UpdateSeries(It.Is<Series>(s => s.Seasons.Count == 2 && s.Seasons.Single(season => season.SeasonNumber == 2).Monitored == true), It.IsAny<bool>(), It.IsAny<bool>()));
}
[Test]
public void should_not_monitor_new_seasons_automatically_if_series_is_not_monitored()
{

View File

@ -6,6 +6,7 @@ namespace NzbDrone.Core.Tv.Commands
{
public class RefreshSeriesCommand : Command
{
public int? SeriesId { get; set; }
public List<int> SeriesIds { get; set; }
public bool IsNewSeries { get; set; }
@ -14,6 +15,11 @@ namespace NzbDrone.Core.Tv.Commands
SeriesIds = new List<int>();
}
public RefreshSeriesCommand(int seriesId, bool isNewSeries = false)
{
SeriesIds = new List<int> { seriesId };
}
public RefreshSeriesCommand(List<int> seriesIds, bool isNewSeries = false)
{
SeriesIds = seriesIds;