diff --git a/src/NzbDrone.Core.Test/ImportListTests/ImportListSyncServiceFixture.cs b/src/NzbDrone.Core.Test/ImportListTests/ImportListSyncServiceFixture.cs index a6b22092e..aa6eef7ff 100644 --- a/src/NzbDrone.Core.Test/ImportListTests/ImportListSyncServiceFixture.cs +++ b/src/NzbDrone.Core.Test/ImportListTests/ImportListSyncServiceFixture.cs @@ -28,6 +28,8 @@ namespace NzbDrone.Core.Test.ImportListTests _importListReports = new List { importListItem1 }; + var mockImportList = new Mock(); + Mocker.GetMock() .Setup(v => v.SearchForNewArtist(It.IsAny())) .Returns(new List()); @@ -40,6 +42,10 @@ namespace NzbDrone.Core.Test.ImportListTests .Setup(v => v.All()) .Returns(new List { new () { ShouldMonitor = ImportListMonitorType.SpecificAlbum } }); + Mocker.GetMock() + .Setup(v => v.AutomaticAddEnabled(It.IsAny())) + .Returns(new List { mockImportList.Object }); + Mocker.GetMock() .Setup(v => v.Fetch()) .Returns(_importListReports); @@ -516,5 +522,31 @@ namespace NzbDrone.Core.Test.ImportListTests Mocker.GetMock() .Verify(v => v.Push(It.IsAny(), CommandPriority.Normal, CommandTrigger.Unspecified), Times.Never); } + + [Test] + public void should_not_fetch_if_no_lists_are_enabled() + { + Mocker.GetMock() + .Setup(v => v.AutomaticAddEnabled(It.IsAny())) + .Returns(new List()); + + Subject.Execute(new ImportListSyncCommand()); + + Mocker.GetMock() + .Verify(v => v.Fetch(), Times.Never); + } + + [Test] + public void should_not_process_if_no_items_are_returned() + { + Mocker.GetMock() + .Setup(v => v.Fetch()) + .Returns(new List()); + + Subject.Execute(new ImportListSyncCommand()); + + Mocker.GetMock() + .Verify(v => v.All(), Times.Never); + } } }