/// <summary> /// Updating a customer request status in the database /// </summary> /// <param name="customerRequestStatus">CustomerRequestStatus entity</param> public bool Update(CustomerRequestStatus customerRequestStatus) { try { _unitOfWork.CustomerRequestStatuses.Update(customerRequestStatus); _unitOfWork.Save(); } catch { return(false); } return(true); }
public void CustomerRequestService_Can_Create_Room() { //Arrange var customerRequestStatus = new CustomerRequestStatus { Name = "NewRequest" }; _unitOfWork.Setup(m => m.CustomerRequestStatuses.Create(customerRequestStatus)); // Act _customerRequestStatusService.Create(customerRequestStatus); // Assert _unitOfWork.Verify(v => v.CustomerRequestStatuses.Create(customerRequestStatus), Times.Once()); _unitOfWork.Verify(x => x.Save(), Times.Once()); }
public void CustomerRequestStatusService_Can_GetById_Valid_CustomerRequestStatus() { //Arrange var customerRequestStatus = new CustomerRequestStatus { Id = 1, Name = "4" }; _unitOfWork.Setup(m => m.CustomerRequestStatuses.GetById(customerRequestStatus.Id)) .Returns(customerRequestStatus); // Act var actual = _customerRequestStatusService.GetById(customerRequestStatus.Id); //Assert _unitOfWork.Verify(); //verify that GetByID was called based on setup. Assert.IsNotNull(actual); //assert that a result was returned Assert.AreEqual(customerRequestStatus, actual); //assert that actual result was as expected }