Adjusted as per @markus101 suggestion and removed the added test.

This commit is contained in:
Stevie Robinson 2023-05-19 09:45:03 +02:00
parent d0471d4811
commit 7a51c3d5dc
2 changed files with 15 additions and 23 deletions

View File

@ -74,23 +74,6 @@ 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

@ -1,12 +1,26 @@
using System.Collections.Generic;
using System.Linq;
using System.Text.Json.Serialization;
using NzbDrone.Common.Extensions;
using NzbDrone.Core.Messaging.Commands;
namespace NzbDrone.Core.Tv.Commands
{
public class RefreshSeriesCommand : Command
{
public int? SeriesId { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public int SeriesId
{
get => 0;
set
{
if (SeriesIds.Empty())
{
SeriesIds.Add(value);
}
}
}
public List<int> SeriesIds { get; set; }
public bool IsNewSeries { get; set; }
@ -15,11 +29,6 @@ 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;