From 78610ff6eed7047b7c50e9dbdb8018afe7dadf5e Mon Sep 17 00:00:00 2001 From: Bogdan Date: Sat, 19 Aug 2023 12:45:56 +0300 Subject: [PATCH] Use `All()` for import lists in ImportListSyncService --- .../ImportListTests/ImportListSyncServiceFixture.cs | 12 ++++-------- .../ImportLists/ImportListSyncService.cs | 3 ++- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/NzbDrone.Core.Test/ImportListTests/ImportListSyncServiceFixture.cs b/src/NzbDrone.Core.Test/ImportListTests/ImportListSyncServiceFixture.cs index afb05684c..a6b22092e 100644 --- a/src/NzbDrone.Core.Test/ImportListTests/ImportListSyncServiceFixture.cs +++ b/src/NzbDrone.Core.Test/ImportListTests/ImportListSyncServiceFixture.cs @@ -28,10 +28,6 @@ namespace NzbDrone.Core.Test.ImportListTests _importListReports = new List { importListItem1 }; - Mocker.GetMock() - .Setup(v => v.Fetch()) - .Returns(_importListReports); - Mocker.GetMock() .Setup(v => v.SearchForNewArtist(It.IsAny())) .Returns(new List()); @@ -41,8 +37,8 @@ namespace NzbDrone.Core.Test.ImportListTests .Returns(new List()); Mocker.GetMock() - .Setup(v => v.Get(It.IsAny())) - .Returns(new ImportListDefinition { ShouldMonitor = ImportListMonitorType.SpecificAlbum }); + .Setup(v => v.All()) + .Returns(new List { new () { ShouldMonitor = ImportListMonitorType.SpecificAlbum } }); Mocker.GetMock() .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() - .Setup(v => v.Get(It.IsAny())) - .Returns(new ImportListDefinition { ShouldMonitor = monitor, ShouldMonitorExisting = shouldMonitorExisting, ShouldSearch = shouldSearch }); + .Setup(v => v.All()) + .Returns(new List { new () { ShouldMonitor = monitor, ShouldMonitorExisting = shouldMonitorExisting, ShouldSearch = shouldSearch } }); } [Test] diff --git a/src/NzbDrone.Core/ImportLists/ImportListSyncService.cs b/src/NzbDrone.Core/ImportLists/ImportListSyncService.cs index ee57744db..fa7c11b6b 100644 --- a/src/NzbDrone.Core/ImportLists/ImportListSyncService.cs +++ b/src/NzbDrone.Core/ImportLists/ImportListSyncService.cs @@ -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()) {