public void TryModifyInvalidBook()
 {
     AssertInvalidBookAllCases(book => Controller.EditBook(-1, book).GetMessage().AssertStatusCode());
     AssertInvalidBookAllCases(book => {
         if (book.Id != -1)
         {
             book.Id = 0;
         }
         Controller.ModelState.Clear();
         Controller.Validate(book);
         Controller.EditBook(0, book).GetMessage().AssertStatusCode();
     });
 }
        public async Task EditBook_True()
        {
            _mockBooksLogic.Setup(x => x.EditBook(It.IsAny <Book>())).ReturnsAsync(true);

            var resultRes = await _controller.EditBook(_bookVM);

            Assert.AreEqual(((ObjectResult)resultRes).Value, true);
            Assert.AreEqual((int)HttpStatusCode.OK, ((ObjectResult)resultRes).StatusCode);
        }
        public void Update_ValidBook_ReturnsTheValidBook()
        {
            // Arrange
            var book = new Book {
                Id = 14, Author = "Lincoln", Rating = 1, Name = "Test2", Description = "some desc", Edition = "5"
            };

            _mockRepository.Setup(x => x.EditBook(book)).Returns(book);

            // Act
            var actionResult  = _controller.EditBook(book);
            var contentResult = actionResult as OkNegotiatedContentResult <Book>;

            // Assert
            Assert.IsNotNull(contentResult);
            Assert.IsNotNull(contentResult.Content);
        }