public ActionResult AddBookAuthor(int bookId, int authorId) { var bookAuthor = new BookAuthor(); bookAuthor.BookId = bookId; bookAuthor.AuthorId = authorId; authorService.AddBookAuthor(bookAuthor); return(RedirectToAction("BookAuthors", new { bookId })); }
public void CreateAuthor_WithValidParameters_SholdNotTrowAnyExceptions() { // Arrange var Author = new Author { Id = 1, FirstName = "Hello", LastName = "World", BookId = 2 }; // Act Action comparison = () => { service.AddBookAuthor(Author); }; // Assert comparison.Should().NotThrow(); }