public void TestRemoveBorrowedBook() { var bookManagerMock = new Mock <IBookManager>(); bookManagerMock.Setup(m => m.GetBookByBookID(It.IsAny <int>())) .Returns(new Book { BookID = 1, Borrow = new Borrow { BorrowID = 1 } }); bookManagerMock.Setup(m => m.RemoveBook(It.IsAny <Book>())); var bookAPI = new BookAPI(bookManagerMock.Object, null); var successfull = bookAPI.RemoveBookFromLibrary(1); Assert.AreEqual(BookErrorCodes.BookBorrowed, successfull); bookManagerMock.Verify(m => m.RemoveBook(It.IsAny <Book>()), Times.Never); }