Use `All()` for import lists in ImportListSyncService

pull/4124/head
Bogdan 9 months ago
parent f9b8d7720c
commit 78610ff6ee

@ -28,10 +28,6 @@ namespace NzbDrone.Core.Test.ImportListTests
_importListReports = new List<ImportListItemInfo> { importListItem1 };
Mocker.GetMock<IFetchAndParseImportList>()
.Setup(v => v.Fetch())
.Returns(_importListReports);
Mocker.GetMock<ISearchForNewArtist>()
.Setup(v => v.SearchForNewArtist(It.IsAny<string>()))
.Returns(new List<Artist>());
@ -41,8 +37,8 @@ namespace NzbDrone.Core.Test.ImportListTests
.Returns(new List<Album>());
Mocker.GetMock<IImportListFactory>()
.Setup(v => v.Get(It.IsAny<int>()))
.Returns(new ImportListDefinition { ShouldMonitor = ImportListMonitorType.SpecificAlbum });
.Setup(v => v.All())
.Returns(new List<ImportListDefinition> { new () { ShouldMonitor = ImportListMonitorType.SpecificAlbum } });
Mocker.GetMock<IFetchAndParseImportList>()
.Setup(v => v.Fetch())
@ -145,8 +141,8 @@ namespace NzbDrone.Core.Test.ImportListTests
private void WithListSettings(ImportListMonitorType monitor = ImportListMonitorType.EntireArtist, bool shouldMonitorExisting = false, bool shouldSearch = true)
{
Mocker.GetMock<IImportListFactory>()
.Setup(v => v.Get(It.IsAny<int>()))
.Returns(new ImportListDefinition { ShouldMonitor = monitor, ShouldMonitorExisting = shouldMonitorExisting, ShouldSearch = shouldSearch });
.Setup(v => v.All())
.Returns(new List<ImportListDefinition> { new () { ShouldMonitor = monitor, ShouldMonitorExisting = shouldMonitorExisting, ShouldSearch = shouldSearch } });
}
[Test]

@ -100,12 +100,13 @@ namespace NzbDrone.Core.ImportLists
var reportNumber = 1;
var listExclusions = _importListExclusionService.All().ToDictionary(x => x.ForeignId);
var importLists = _importListFactory.All();
foreach (var item in items)
{
_logger.ProgressTrace("Processing list item {0}/{1}", reportNumber++, items.Count);
var importList = _importListFactory.Get(item.ImportListId);
var importList = importLists.Single(x => x.Id == item.ImportListId);
if (item.Album.IsNotNullOrWhiteSpace() || item.AlbumMusicBrainzId.IsNotNullOrWhiteSpace())
{

Loading…
Cancel
Save