|
|
|
@ -27,6 +27,8 @@ namespace NzbDrone.Core.Test.ImportListTests
|
|
|
|
|
|
|
|
|
|
_importListReports = new List<ImportListItemInfo> { importListItem1 };
|
|
|
|
|
|
|
|
|
|
var mockImportList = new Mock<IImportList>();
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<IFetchAndParseImportList>()
|
|
|
|
|
.Setup(v => v.Fetch())
|
|
|
|
|
.Returns(_importListReports);
|
|
|
|
@ -53,6 +55,10 @@ namespace NzbDrone.Core.Test.ImportListTests
|
|
|
|
|
.Setup(v => v.Get(It.IsAny<int>()))
|
|
|
|
|
.Returns(new ImportListDefinition { ShouldMonitor = ImportListMonitorType.SpecificBook });
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<IImportListFactory>()
|
|
|
|
|
.Setup(v => v.AutomaticAddEnabled(It.IsAny<bool>()))
|
|
|
|
|
.Returns(new List<IImportList> { mockImportList.Object });
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<IFetchAndParseImportList>()
|
|
|
|
|
.Setup(v => v.Fetch())
|
|
|
|
|
.Returns(_importListReports);
|
|
|
|
@ -322,5 +328,31 @@ namespace NzbDrone.Core.Test.ImportListTests
|
|
|
|
|
t.First().AddOptions.BooksToMonitor.Count == expectedBooksMonitored &&
|
|
|
|
|
t.First().Monitored == expectedAuthorMonitored), false));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_not_fetch_if_no_lists_are_enabled()
|
|
|
|
|
{
|
|
|
|
|
Mocker.GetMock<IImportListFactory>()
|
|
|
|
|
.Setup(v => v.AutomaticAddEnabled(It.IsAny<bool>()))
|
|
|
|
|
.Returns(new List<IImportList>());
|
|
|
|
|
|
|
|
|
|
Subject.Execute(new ImportListSyncCommand());
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<IFetchAndParseImportList>()
|
|
|
|
|
.Verify(v => v.Fetch(), Times.Never);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_not_process_if_no_items_are_returned()
|
|
|
|
|
{
|
|
|
|
|
Mocker.GetMock<IFetchAndParseImportList>()
|
|
|
|
|
.Setup(v => v.Fetch())
|
|
|
|
|
.Returns(new List<ImportListItemInfo>());
|
|
|
|
|
|
|
|
|
|
Subject.Execute(new ImportListSyncCommand());
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<IImportListExclusionService>()
|
|
|
|
|
.Verify(v => v.All(), Times.Never);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|