mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-25 22:36:59 -04:00
New: Option to control which new author books get monitored
This commit is contained in:
@@ -62,7 +62,7 @@ namespace NzbDrone.Core.Test.MusicTests
|
||||
|
||||
Mocker.GetMock<IMetadataProfileService>()
|
||||
.Setup(s => s.FilterBooks(It.IsAny<Author>(), It.IsAny<int>()))
|
||||
.Returns(_books);
|
||||
.Returns(_remoteBooks);
|
||||
|
||||
Mocker.GetMock<IProvideAuthorInfo>()
|
||||
.Setup(s => s.GetAuthorAndBooks(It.IsAny<string>(), It.IsAny<double>()))
|
||||
@@ -83,6 +83,10 @@ namespace NzbDrone.Core.Test.MusicTests
|
||||
Mocker.GetMock<IRootFolderService>()
|
||||
.Setup(x => x.All())
|
||||
.Returns(new List<RootFolder>());
|
||||
|
||||
Mocker.GetMock<IMonitorNewBookService>()
|
||||
.Setup(x => x.ShouldMonitorNewBook(It.IsAny<Book>(), It.IsAny<List<Book>>(), It.IsAny<NewItemMonitorTypes>()))
|
||||
.Returns(true);
|
||||
}
|
||||
|
||||
private void GivenNewAuthorInfo(Author author)
|
||||
@@ -151,6 +155,29 @@ namespace NzbDrone.Core.Test.MusicTests
|
||||
VerifyEventPublished<AuthorRefreshCompleteEvent>();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_call_new_book_monitor_service_when_adding_book()
|
||||
{
|
||||
var newBook = Builder<Book>.CreateNew()
|
||||
.With(x => x.Id = 0)
|
||||
.With(x => x.ForeignBookId = "3")
|
||||
.Build();
|
||||
_remoteBooks.Add(newBook);
|
||||
|
||||
var newAuthorInfo = _author.JsonClone();
|
||||
newAuthorInfo.Metadata = _author.Metadata.Value.JsonClone();
|
||||
newAuthorInfo.Books = _remoteBooks;
|
||||
|
||||
GivenNewAuthorInfo(newAuthorInfo);
|
||||
GivenBooksForRefresh(_books);
|
||||
AllowAuthorUpdate();
|
||||
|
||||
Subject.Execute(new RefreshAuthorCommand(_author.Id));
|
||||
|
||||
Mocker.GetMock<IMonitorNewBookService>()
|
||||
.Verify(x => x.ShouldMonitorNewBook(newBook, _books, _author.MonitorNewItems), Times.Once());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_log_error_and_delete_if_musicbrainz_id_not_found_and_author_has_no_files()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user