public void ThenWhenEditStatusIsIncorrectAnInvalidRequestExceptionIsThrown(EditStatus editStatus, CallerType callerType) { var c = new Commitment { EditStatus = editStatus, ProviderId = 5L, EmployerAccountId = 5L, CommitmentStatus = CommitmentStatus.Active }; _exampleValidRequest.Caller = new Caller { Id = 5L, CallerType = callerType }; _mockCommitmentRespository.Setup(m => m.GetCommitmentById(It.IsAny <long>())).Returns(Task.Run(() => c)); Func <Task> act = async() => await _handler.Handle(_exampleValidRequest); act.ShouldThrow <UnauthorizedException>(); }
private CommitmentChangeType DetermineHistoryChangeType(LastAction latestAction, EditStatus updatedEditStatus) { var changeType = CommitmentChangeType.SentForReview; if (updatedEditStatus == EditStatus.Both && latestAction == LastAction.Approve) { changeType = CommitmentChangeType.FinalApproval; } else if (latestAction == LastAction.Approve) { changeType = CommitmentChangeType.SentForApproval; } return(changeType); }
public void ThenThrowExceptionIfEditStatusIsNotSetToNeither(EditStatus status) { _commitment.EditStatus = status; Assert.ThrowsAsync <InvalidOperationException>(() => _sut.Handle(_command)); }