public void ReviewingTransitionStates(string testcaseName, LoanApplicationStatus startingStatus,
                                              LoanApplicationState toState, LoanApplicationState expectedState, LoanApplicationStatus expectedStatus)
        {
            var loanApplicationInfo = TransitionToReviewingState(borrowerRegistration);
            var loanApplicationGuid = loanApplicationInfo.LoanApplicationGuid.ToString();

            // If we're already are at InReviewNeedDecision, then we don't need to do any further transitioning for our stating status.
            if (startingStatus != LoanApplicationStatus.NewAppNeedInitialReview)
            {
                if (!ReviewStatusTransitions(loanApplicationInfo.LoanApplicationGuid, startingStatus))
                {
                    Assert.Fail($"Unable to transition to the desired loan status of {startingStatus.ToString()}...stopping test.");
                }
            }
            log.Info($"We're in the expected status of {startingStatus.ToString()}.  Transitioning to {expectedState}...");

            var stateUpdateResponse = new ResponseObject <EmptyResult>();

            switch (toState)
            {
            case LoanApplicationState.Accepting:
            case LoanApplicationState.Finalizing:
                stateUpdateResponse = loanApplicationClient.SetLoanAppToAccept(loanApplicationGuid);
                break;

            case LoanApplicationState.Expired:
                stateUpdateResponse = loanApplicationClient.SetLoanAppToExpire(loanApplicationGuid);
                break;

            case LoanApplicationState.Declined:
                stateUpdateResponse = loanApplicationStateClient.ChangeStateToDecline(loanApplicationGuid);
                break;

            case LoanApplicationState.Withdrawn:
                stateUpdateResponse = loanApplicationStateClient.ChangeStateToWithdraw(loanApplicationGuid);
                break;

            default:
                Assert.Fail($"{toState.ToString()} is in invalid argument for this test...failing.");
                break;
            }

            Assert.That(stateUpdateResponse.statusCode == HttpStatusCode.OK ||
                        (stateUpdateResponse.statusCode == HttpStatusCode.NoContent),
                        $"We weren't able to successfully run the workflow transition request successfully.  Status code {stateUpdateResponse.statusCode}");
            log.Info($"Checking to see that our loan application in the expected Declined/Declined state/status.");

            coreLoanApplicationStatusClient
            .UpdateStatusByLoanApplication(loanApplicationInfo.LoanApplicationGuid.ToString());
            var statusResponse = coreLoanApplicationStatusClient
                                 .GetStatusByLoanApplication(loanApplicationInfo.LoanApplicationGuid.ToString());

            Assert.That(statusResponse.statusCode == HttpStatusCode.OK, $"We weren't able to get the status of our loanapplication successfully.  Status Code {statusResponse.statusCode.ToString()}");
            Assert.NotNull(statusResponse.content, "We received no content for our status request.");

            ValidateApplicationState(statusResponse.content, expectedState, expectedStatus);
            log.Info($"Validated the successful transition from {startingStatus} to {expectedState}/{expectedStatus} for loan application guid:  {loanApplicationInfo.LoanApplicationGuid}");
        }
        public void PipelineLoanStateTransitionToAccepting()
        {
            LoanApplicationCoreStateObject borrowerState = TransitionToReviewingState(borrowerRegistration);
            int emailCount  = GetEmails(emailAddress).Count;
            var stateClient = new LoanApplicationStateClient();
            var noContent   = new ResponseObject <EmptyResult>();

            noContent = loanApplicationClient
                        .WorkflowAction(borrowerState.LoanApplicationGuid.ToString(), LoanApplicationWorkflowAction.Counter);
            noContent = loanApplicationClient
                        .SetLoanAppToAccept(borrowerState.LoanApplicationGuid.ToString());
            Assert.That(noContent.statusCode == HttpStatusCode.OK);

            var stateResult = loanApplicationClient.Status(borrowerState.LoanApplicationGuid.ToString());

            Assert.That(stateResult.content.LoanApplicationState == LoanApplicationState.Accepting);

            List <string> emails = GetEmails(emailAddress);

            Assert.That(emails.Count > emailCount);
        }