diff --git a/src/NzbDrone.Core.Test/ImportListTests/ImportListSyncServiceFixture.cs b/src/NzbDrone.Core.Test/ImportListTests/ImportListSyncServiceFixture.cs index da938b34e..870dd66fc 100644 --- a/src/NzbDrone.Core.Test/ImportListTests/ImportListSyncServiceFixture.cs +++ b/src/NzbDrone.Core.Test/ImportListTests/ImportListSyncServiceFixture.cs @@ -25,6 +25,8 @@ namespace NzbDrone.Core.Test.ImportListTests _importListReports = new List { importListItem1 }; + var mockImportList = new Mock(); + Mocker.GetMock() .Setup(v => v.AllSeriesTvdbIds()) .Returns(new List()); @@ -41,6 +43,10 @@ namespace NzbDrone.Core.Test.ImportListTests .Setup(v => v.All()) .Returns(new List { new ImportListDefinition { ShouldMonitor = MonitorTypes.All } }); + Mocker.GetMock() + .Setup(v => v.AutomaticAddEnabled(It.IsAny())) + .Returns(new List { mockImportList.Object }); + Mocker.GetMock() .Setup(v => v.Fetch()) .Returns(_importListReports); @@ -152,5 +158,31 @@ namespace NzbDrone.Core.Test.ImportListTests Mocker.GetMock() .Verify(v => v.AddSeries(It.Is>(t => t.Count == 0), It.IsAny())); } + + [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); + } } }