public void NewAppNeedInitialToInReviewNeedUwDecision()
        {
            LoanApplicationCoreStateObject loanApplicationInfo         = TransitionToReviewingState(borrowerRegistration);
            ResponseObject <GetLoanApplicationStatusResponse> response = coreLoanApplicationStatusClient
                                                                         .GetStatusByLoanApplication(loanApplicationInfo.LoanApplicationGuid.ToString());

            if (response.content == null ||
                response.content.LoanApplicationState != LoanApplicationState.Reviewing ||
                response.content.LoanApplicationStatus != LoanApplicationStatus.NewAppNeedInitialReview)
            {
                var message = response.content == null ? "No response was returned, null content object." : $"State = {response.content.LoanApplicationState.ToString()}, Status = {response.content.LoanApplicationStatus.ToString()}";
                log.Error("Failing test due to invalid setup state for our loan application...");
                Assert.Fail($"Loan Application State or Status not in the valid state or status; unable to continue - {message}");
            }

            AssignAgentToLoanApplication((Guid)loanApplicationInfo.LoanApplicationGuid, AgentRole.UW, "clpuw");
            var coreLoanAppClient = new LoanApplicationClient();
            var workflowResponse  = coreLoanAppClient.WorkflowAction(loanApplicationInfo.LoanApplicationGuid.ToString(), LoanApplicationWorkflowAction.SendToUW);

            Assert.That(workflowResponse.statusCode == HttpStatusCode.OK, $"Invalid status code returned when attempting workflow transition:  {workflowResponse.statusCode}");
            log.Info("Checking the actual status of our loan application after transitioning to SendToUW");

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

            log.Info("transitioning the status...");

            coreLoanApplicationStatusClient
            .UpdateStatusByLoanApplication(loanApplicationInfo.LoanApplicationGuid.ToString());
            Assert.That(statusResponse.statusCode == HttpStatusCode.OK, $"We received an invalid status code from our core loanapplication status request:  {statusResponse.statusCode}.");
            Assert.NotNull(statusResponse.content, "We have a response but the response content is null for our status request");
            ValidateApplicationState(statusResponse.content, LoanApplicationState.Reviewing, LoanApplicationStatus.InReviewNeedDecision);
            log.Info("We have successfully transitioned our loan application into the Reviewing/InReviewNeedDecision.  Now we must check to see if we have an Agent assigned.");
        }
        public static bool ReviewStatusTransitions(Guid?loanAppInfoGuid, LoanApplicationStatus targetStatus)
        {
            var client = new LoanApplicationClient();

            switch (targetStatus)
            {
            case (LoanApplicationStatus.InReviewNeedDecision):
                AssignAgentToLoanApplication((Guid)loanAppInfoGuid, AgentRole.UW, "clpuw");
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.SendToUW);
                break;

            case (LoanApplicationStatus.EscalatedNeedFAReview):
                AssignAgentToLoanApplication((Guid)loanAppInfoGuid, AgentRole.UW, "clpuw");
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.SendToUW);
                AssignAgentToLoanApplication((Guid)loanAppInfoGuid, AgentRole.FA, "clpfa");
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.EscalateToFA);
                break;

            case (LoanApplicationStatus.EscalatedNeedFAManagerReview):
                AssignAgentToLoanApplication((Guid)loanAppInfoGuid, AgentRole.UW, "clpuw");
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.SendToUW);
                AssignAgentToLoanApplication((Guid)loanAppInfoGuid, AgentRole.FA, "clpfa");
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.EscalateToFA);
                AssignAgentToLoanApplication((Guid)loanAppInfoGuid, AgentRole.FAM, "clpfam");
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.EscalateToManager);
                break;

            case (LoanApplicationStatus.EscalatedNeedUWManagerReview):
                AssignAgentToLoanApplication((Guid)loanAppInfoGuid, AgentRole.UW, "clpuw");
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.SendToUW);
                AssignAgentToLoanApplication((Guid)loanAppInfoGuid, AgentRole.UWM, "clpuwm");
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.EscalateToManager);
                break;

            case (LoanApplicationStatus.EditRequestNeedUWReview):
                AssignAgentToLoanApplication((Guid)loanAppInfoGuid, AgentRole.UW, "clpuw");
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.SendToUW);
                UpdateLoanApplicationPassStips(loanAppInfoGuid.ToString());
                DispositionOfUploadedFiles(loanAppInfoGuid.ToString(), "Approve");
                SignPromissoryAndFTIL(loanAppInfoGuid.ToString());
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.Counter);
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.Approve);
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.SendToUW);
                break;

            case (LoanApplicationStatus.ReturnedfromVerbalNeedUWReview):
                AssignAgentToLoanApplication((Guid)loanAppInfoGuid, AgentRole.UW, "clpuw");
                AssignAgentToLoanApplication((Guid)loanAppInfoGuid, AgentRole.FA, "clpfa");
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.SendToUW);
                UpdateLoanApplicationPassStips(loanAppInfoGuid.ToString());
                DispositionOfUploadedFiles(loanAppInfoGuid.ToString());
                SignPromissoryAndFTIL(loanAppInfoGuid.ToString());
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.Counter);
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.Approve);
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.Escalate);
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.SendToUW);
                break;

            case (LoanApplicationStatus.ReturnedfromFundingNeedUWManagerReview):
                AssignAgentToLoanApplication((Guid)loanAppInfoGuid, AgentRole.UW, "clpuw");
                AssignAgentToLoanApplication((Guid)loanAppInfoGuid, AgentRole.UWM, "clpuwm");
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.SendToUW);
                UpdateLoanApplicationPassStips(loanAppInfoGuid.ToString());
                DispositionOfUploadedFiles(loanAppInfoGuid.ToString());
                SignPromissoryAndFTIL(loanAppInfoGuid.ToString());
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.Counter);
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.Approve);
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.VerbalQueue);
                VerbalVerification(loanAppInfoGuid.ToString());
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.PassVerbal);
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.ReturnToUW);
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.EscalateToManager);
                break;

            case (LoanApplicationStatus.ApprovedPendingNote):
                AssignAgentToLoanApplication((Guid)loanAppInfoGuid, AgentRole.UW, "clpuw");
                AssignAgentToLoanApplication((Guid)loanAppInfoGuid, AgentRole.FA, "clpfa");
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.SendToUW);
                UpdateLoanApplicationPassStips(loanAppInfoGuid.ToString());
                DispositionOfUploadedFiles(loanAppInfoGuid.ToString());
                SignPromissoryAndFTIL(loanAppInfoGuid.ToString());
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.Approve);
                break;

            case (LoanApplicationStatus.NoteSignedNeedVerbal):
                AssignAgentToLoanApplication((Guid)loanAppInfoGuid, AgentRole.UW, "clpuw");
                AssignAgentToLoanApplication((Guid)loanAppInfoGuid, AgentRole.FA, "clpfa");
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.SendToUW);
                UpdateLoanApplicationPassStips(loanAppInfoGuid.ToString());
                DispositionOfUploadedFiles(loanAppInfoGuid.ToString());
                SignPromissoryAndFTIL(loanAppInfoGuid.ToString());
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.Counter);
                SignLoanPacket(loanAppInfoGuid.ToString());
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.VerbalQueue);
                break;

            case (LoanApplicationStatus.VerbalVerifiedNeedFunding):
                AssignAgentToLoanApplication((Guid)loanAppInfoGuid, AgentRole.UW, "clpuw");
                AssignAgentToLoanApplication((Guid)loanAppInfoGuid, AgentRole.FA, "clpfa");
                AssignAgentToLoanApplication((Guid)loanAppInfoGuid, AgentRole.FAM, "clpfam");
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.SendToUW);
                UpdateLoanApplicationPassStips(loanAppInfoGuid.ToString());
                DispositionOfUploadedFiles(loanAppInfoGuid.ToString());
                SignPromissoryAndFTIL(loanAppInfoGuid.ToString());
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.Counter);
                SignLoanPacket(loanAppInfoGuid.ToString());
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.VerbalQueue);
                VerbalVerification(loanAppInfoGuid.ToString());
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.PassVerbal);
                break;

            default:
                log.Error($"Functionality for LoanApplicationStatus {targetStatus.ToString()} is Not Available for this method");
                return(false);
            }

            var statusClient = new LoanApplicationStatusClient();

            statusClient.UpdateStatusByLoanApplication(loanAppInfoGuid.ToString());
            var statusResponse = statusClient.GetStatusByLoanApplication(loanAppInfoGuid.ToString());

            if (statusResponse.statusCode != HttpStatusCode.OK || statusResponse.content == null)
            {
                log.Error($"Error in checking the response of our status request (null content or invalid statuscode).");
                return(false);
            }
            else
            {
                if (statusResponse.content.LoanApplicationStatus == targetStatus)
                {
                    return(true);
                }
                else
                {
                    log.Error($"Wrong status generated for our request to transition to {targetStatus.ToString()} we received {statusResponse.content.LoanApplicationStatus.ToString()}.");
                    return(false);
                }
            }
        }