using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Moq; using NUnit.Framework; using NzbDrone.Core.DecisionEngine; using NzbDrone.Core.Download; using NzbDrone.Core.IndexerSearch; using NzbDrone.Core.Messaging.Commands; using NzbDrone.Core.Music; using NzbDrone.Core.Test.Framework; namespace NzbDrone.Core.Test.IndexerSearchTests { [TestFixture] public class ArtistSearchServiceFixture : CoreTest { private Artist _artist; [SetUp] public void Setup() { _artist = new Artist(); Mocker.GetMock() .Setup(s => s.GetArtist(It.IsAny())) .Returns(_artist); Mocker.GetMock() .Setup(s => s.ArtistSearch(_artist.Id, false, true, false)) .Returns(Task.FromResult(new List())); Mocker.GetMock() .Setup(s => s.ProcessDecisions(It.IsAny>())) .Returns(Task.FromResult(new ProcessedDecisions(new List(), new List(), new List()))); } [Test] public void should_only_include_monitored_albums() { _artist.Albums = new List { new Album { Monitored = false }, new Album { Monitored = true } }; Subject.Execute(new ArtistSearchCommand { ArtistId = _artist.Id, Trigger = CommandTrigger.Manual }); Mocker.GetMock() .Verify(v => v.ArtistSearch(_artist.Id, false, true, false), Times.Exactly(_artist.Albums.Value.Count(s => s.Monitored))); } } }