public IActionResult UpdateBook(string id, BookUpdateIn bookIn) { var book = bookService.GetBook(id); if (book == null) { return(NotFound()); } book.Parse(bookIn); bookService.UpdateBook(id, book); return(Ok()); }
public void UpdateBookWithBasicData() { var book = BookControllerTestHelper.AddOneBook(bookRepository); var title = "Test Book"; var bookUpdateIn = new BookUpdateIn { Title = title }; controller .Calling(c => c.UpdateBook(book.Id, bookUpdateIn)) .ShouldReturn() .Ok(); var bookResult = bookRepository.GetById(book.Id); Assert.AreEqual(bookResult.Title, title); }