Add equivalent of SeriesSearchServiceFixture for artists

pull/18/head
Daniel Underwood 7 years ago
parent 5b22e5a9ae
commit 1d46e718bb

@ -0,0 +1,56 @@
using System.Collections.Generic;
using System.Linq;
using FluentAssertions;
using Moq;
using NUnit.Framework;
using NzbDrone.Core.DecisionEngine;
using NzbDrone.Core.Download;
using NzbDrone.Core.IndexerSearch;
using NzbDrone.Core.Test.Framework;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Messaging.Commands;
using NzbDrone.Core.Music;
namespace NzbDrone.Core.Test.IndexerSearchTests
{
[TestFixture]
public class ArtistSearchServiceFixture : CoreTest<ArtistSearchService>
{
private Artist _artist;
[SetUp]
public void Setup()
{
_artist = new Artist();
Mocker.GetMock<IArtistService>()
.Setup(s => s.GetArtist(It.IsAny<int>()))
.Returns(_artist);
Mocker.GetMock<ISearchForNzb>()
.Setup(s => s.ArtistSearch(_artist.Id, false, true))
.Returns(new List<DownloadDecision>());
Mocker.GetMock<IProcessDownloadDecisions>()
.Setup(s => s.ProcessDecisions(It.IsAny<List<DownloadDecision>>()))
.Returns(new ProcessedDecisions(new List<DownloadDecision>(), new List<DownloadDecision>(),
new List<DownloadDecision>()));
}
[Test]
public void should_only_include_monitored_albums()
{
_artist.Albums = new List<Album>
{
new Album {Monitored = false},
new Album {Monitored = true}
};
Subject.Execute(new ArtistSearchCommand {ArtistId = _artist.Id, Trigger = CommandTrigger.Manual});
Mocker.GetMock<ISearchForNzb>()
.Verify(v => v.ArtistSearch(_artist.Id, false, true),
Times.Exactly(_artist.Albums.Count(s => s.Monitored)));
}
}
}

@ -12,6 +12,7 @@ using NzbDrone.Core.Messaging.Commands;
namespace NzbDrone.Core.Test.IndexerSearchTests
{
[System.Obsolete("Sonarr TV stuff. Not needed in lidarr.")]
[TestFixture]
public class SeriesSearchServiceFixture : CoreTest<SeriesSearchService>
{

Loading…
Cancel
Save