Fixed: UpdateAlbums was a duplicate of UpdateMany

This commit is contained in:
ta264 2019-07-09 21:13:52 +01:00
parent 76db27e8c2
commit f5c1858d4c
3 changed files with 5 additions and 16 deletions

View File

@ -60,7 +60,7 @@ namespace NzbDrone.Core.Test.MusicTests.AlbumMonitoredServiceTests
.Verify(v => v.UpdateArtist(It.IsAny<Artist>()), Times.Once());
Mocker.GetMock<IAlbumService>()
.Verify(v => v.UpdateAlbums(It.IsAny<List<Album>>()), Times.Never());
.Verify(v => v.UpdateMany(It.IsAny<List<Album>>()), Times.Never());
}
[Test]
@ -83,7 +83,7 @@ namespace NzbDrone.Core.Test.MusicTests.AlbumMonitoredServiceTests
Subject.SetAlbumMonitoredStatus(_artist, new MonitoringOptions{Monitor = MonitorTypes.All});
Mocker.GetMock<IAlbumService>()
.Verify(v => v.UpdateAlbums(It.Is<List<Album>>(l => l.All(e => e.Monitored))));
.Verify(v => v.UpdateMany(It.Is<List<Album>>(l => l.All(e => e.Monitored))));
}
[Test]
@ -104,13 +104,13 @@ namespace NzbDrone.Core.Test.MusicTests.AlbumMonitoredServiceTests
private void VerifyMonitored(Func<Album, bool> predicate)
{
Mocker.GetMock<IAlbumService>()
.Verify(v => v.UpdateAlbums(It.Is<List<Album>>(l => l.Where(predicate).All(e => e.Monitored))));
.Verify(v => v.UpdateMany(It.Is<List<Album>>(l => l.Where(predicate).All(e => e.Monitored))));
}
private void VerifyNotMonitored(Func<Album, bool> predicate)
{
Mocker.GetMock<IAlbumService>()
.Verify(v => v.UpdateAlbums(It.Is<List<Album>>(l => l.Where(predicate).All(e => !e.Monitored))));
.Verify(v => v.UpdateMany(It.Is<List<Album>>(l => l.Where(predicate).All(e => !e.Monitored))));
}
}
}

View File

@ -92,7 +92,7 @@ namespace NzbDrone.Core.Music
}
}
_albumService.UpdateAlbums(albums);
_albumService.UpdateMany(albums);
}
_artistService.UpdateArtist(artist);

View File

@ -25,7 +25,6 @@ namespace NzbDrone.Core.Music
void DeleteAlbum(int albumId, bool deleteFiles);
List<Album> GetAllAlbums();
Album UpdateAlbum(Album album);
List<Album> UpdateAlbums(List<Album> album);
void SetAlbumMonitored(int albumId, bool monitored);
void SetMonitored(IEnumerable<int> ids, bool monitored);
PagingSpec<Album> AlbumsWithoutFiles(PagingSpec<Album> pagingSpec);
@ -280,16 +279,6 @@ namespace NzbDrone.Core.Music
}
}
public List<Album> UpdateAlbums(List<Album> albums)
{
_logger.Debug("Updating {0} albums", albums.Count);
_albumRepository.UpdateMany(albums);
_logger.Debug("{0} albums updated", albums.Count);
return albums;
}
public void Handle(ArtistDeletedEvent message)
{
var albums = GetAlbumsByArtistMetadataId(message.Artist.ArtistMetadataId);