diff --git a/src/NzbDrone.Core.Test/ImportListTests/ImportListSyncServiceFixture.cs b/src/NzbDrone.Core.Test/ImportListTests/ImportListSyncServiceFixture.cs index 968c14636..8cf73b463 100644 --- a/src/NzbDrone.Core.Test/ImportListTests/ImportListSyncServiceFixture.cs +++ b/src/NzbDrone.Core.Test/ImportListTests/ImportListSyncServiceFixture.cs @@ -27,6 +27,8 @@ public void SetUp() _importListReports = new List { importListItem1 }; + var mockImportList = new Mock(); + Mocker.GetMock() .Setup(v => v.Fetch()) .Returns(_importListReports); @@ -53,6 +55,10 @@ public void SetUp() .Setup(v => v.Get(It.IsAny())) .Returns(new ImportListDefinition { ShouldMonitor = ImportListMonitorType.SpecificBook }); + Mocker.GetMock() + .Setup(v => v.AutomaticAddEnabled(It.IsAny())) + .Returns(new List { mockImportList.Object }); + Mocker.GetMock() .Setup(v => v.Fetch()) .Returns(_importListReports); @@ -322,5 +328,31 @@ public void should_add_two_books(ImportListMonitorType monitor, int expectedBook t.First().AddOptions.BooksToMonitor.Count == expectedBooksMonitored && t.First().Monitored == expectedAuthorMonitored), false)); } + + [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); + } } }