private void WithMonitorType(ImportListMonitorType monitor) { Mocker.GetMock <IImportListFactory>() .Setup(v => v.Get(It.IsAny <int>())) .Returns(new ImportListDefinition { ShouldMonitor = monitor }); }
public void should_add_if_not_existing_album(ImportListMonitorType monitor, bool expectedAlbumMonitored) { WithBookId(); WithMonitorType(monitor); Subject.Execute(new ImportListSyncCommand()); Mocker.GetMock <IAddBookService>() .Verify(v => v.AddBooks(It.Is <List <Book> >(t => t.Count == 1 && t.First().Monitored == expectedAlbumMonitored), false)); }
public void should_add_if_not_existing_artist(ImportListMonitorType monitor, bool expectedArtistMonitored) { WithArtistId(); WithMonitorType(monitor); Subject.Execute(new ImportListSyncCommand()); Mocker.GetMock <IAddArtistService>() .Verify(v => v.AddArtists(It.Is <List <Artist> >(t => t.Count == 1 && t.First().Monitored == expectedArtistMonitored), false, It.IsAny <bool>())); }
public void should_add_two_books(ImportListMonitorType monitor, int expectedBooksMonitored, bool expectedAuthorMonitored) { WithBook(); WithBookId(); WithSecondBook(); WithAuthorId(); WithMonitorType(monitor); Subject.Execute(new ImportListSyncCommand()); Mocker.GetMock <IAddBookService>() .Verify(v => v.AddBooks(It.Is <List <Book> >(t => t.Count == 2), false)); Mocker.GetMock <IAddAuthorService>() .Verify(v => v.AddAuthors(It.Is <List <Author> >(t => t.Count == 1 && t.First().AddOptions.BooksToMonitor.Count == expectedBooksMonitored && t.First().Monitored == expectedAuthorMonitored), false)); }