public void TestReturnBookFromCustomer() { var returnManagerMock = new Mock <IReturnManager>(); returnManagerMock.Setup(m => m.GetCustomerByCustomerNumber(It.IsAny <int>())) .Returns(new Customer { CustomerID = 1, Book = new List <Book>(), });; var returnAPI = new ReturnAPI(returnManagerMock.Object); var successfull = returnAPI.ReturnBook(1, 1, 0); Assert.AreEqual(ReturnBookErrorCodes.Ok, successfull); returnManagerMock.Verify(m => m.ReturnBookFromCustomer(It.IsAny <int>(), It.IsAny <int>(), It.IsAny <int>()), Times.Once); }
public void TestReturnBookWhereBookConditionIsThree() { var returnManagerMock = new Mock <IReturnManager>(); var bookMangerMock = new Mock <IBookManager>(); returnManagerMock.Setup(m => m.GetCustomerByCustomerNumber(It.IsAny <int>())) .Returns(new Customer { CustomerID = 1, CustomerNumber = 1, Book = new List <Book>(), });; var returnAPI = new ReturnAPI(returnManagerMock.Object); var successfull = returnAPI.ReturnBook(1, 1, 3); Assert.AreEqual(ReturnBookErrorCodes.BookConditionIsThree, successfull); returnManagerMock.Verify(m => m.ReturnBookFromCustomer(It.IsAny <int>(), It.IsAny <int>(), It.IsAny <int>()), Times.Never); }