Example #1
0
        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 }));
        }
Example #2
0
        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();
        }