Fix tests for ImportListSyncService

(cherry picked from commit b271b3b694081a2889d75d39dc0296d53c734aaf)
pull/4124/head v1.3.5.3530
Mark McDowall 1 year ago committed by Bogdan
parent 78610ff6ee
commit 85e62caccf

@ -28,6 +28,8 @@ namespace NzbDrone.Core.Test.ImportListTests
_importListReports = new List<ImportListItemInfo> { importListItem1 }; _importListReports = new List<ImportListItemInfo> { importListItem1 };
var mockImportList = new Mock<IImportList>();
Mocker.GetMock<ISearchForNewArtist>() Mocker.GetMock<ISearchForNewArtist>()
.Setup(v => v.SearchForNewArtist(It.IsAny<string>())) .Setup(v => v.SearchForNewArtist(It.IsAny<string>()))
.Returns(new List<Artist>()); .Returns(new List<Artist>());
@ -40,6 +42,10 @@ namespace NzbDrone.Core.Test.ImportListTests
.Setup(v => v.All()) .Setup(v => v.All())
.Returns(new List<ImportListDefinition> { new () { ShouldMonitor = ImportListMonitorType.SpecificAlbum } }); .Returns(new List<ImportListDefinition> { new () { ShouldMonitor = ImportListMonitorType.SpecificAlbum } });
Mocker.GetMock<IImportListFactory>()
.Setup(v => v.AutomaticAddEnabled(It.IsAny<bool>()))
.Returns(new List<IImportList> { mockImportList.Object });
Mocker.GetMock<IFetchAndParseImportList>() Mocker.GetMock<IFetchAndParseImportList>()
.Setup(v => v.Fetch()) .Setup(v => v.Fetch())
.Returns(_importListReports); .Returns(_importListReports);
@ -516,5 +522,31 @@ namespace NzbDrone.Core.Test.ImportListTests
Mocker.GetMock<IManageCommandQueue>() Mocker.GetMock<IManageCommandQueue>()
.Verify(v => v.Push<Command>(It.IsAny<MissingAlbumSearchCommand>(), CommandPriority.Normal, CommandTrigger.Unspecified), Times.Never); .Verify(v => v.Push<Command>(It.IsAny<MissingAlbumSearchCommand>(), CommandPriority.Normal, CommandTrigger.Unspecified), Times.Never);
} }
[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);
}
} }
} }

Loading…
Cancel
Save