public async Task Check_oversight_details_result_is_as_expected()
        {
            var applicationId = Guid.NewGuid();

            var oversight = new ApplicationOversightDetails
            {
                Id                         = Guid.NewGuid(),
                ApplicationId              = applicationId,
                OrganisationName           = "XXX Limited",
                Ukprn                      = "12344321",
                ProviderRoute              = "Main",
                ApplicationReferenceNumber = "APR000111",
                OversightStatus            = OversightReviewStatus.InProgress
            };

            _mediator
            .Setup(x => x.Send(It.IsAny <GetOversightApplicationDetailsRequest>(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(oversight);

            var actualResult = await _controller.OversightDetails(applicationId);

            var returnedOversight = actualResult.Value;

            Assert.That(returnedOversight, Is.SameAs(oversight));
        }
        public async Task ViewApplication_when_submitted_for_review_shows_expected_view(string gatewayReviewStatus)
        {
            var applicationId = Guid.NewGuid();

            var application = new Apply
            {
                ApplicationId       = applicationId,
                ApplicationStatus   = ApplicationStatus.Submitted,
                GatewayReviewStatus = gatewayReviewStatus,
                ApplyData           = new ApplyData {
                    ApplyDetails = new ApplyDetails()
                }
            };

            var oversightDetails = new ApplicationOversightDetails {
                OversightStatus = OversightReviewStatus.None
            };

            var viewmodel = new RoatpGatewayApplicationViewModel(application, oversightDetails);

            _orchestrator.Setup(x => x.GetOverviewViewModel(It.IsAny <GetApplicationOverviewRequest>())).ReturnsAsync(viewmodel);

            var result = await _controller.ViewApplication(applicationId);

            var viewResult = result as ViewResult;

            Assert.IsTrue(viewResult.ViewName.EndsWith("Application.cshtml"));
        }
        public RoatpGatewayApplicationViewModel(Apply application, ApplicationOversightDetails oversightDetails)
        {
            ApplicationId = application.ApplicationId;
            OrgId         = application.OrganisationId;

            ApplicationStatus   = application.ApplicationStatus;
            HasOversightOutcome = oversightDetails.OversightStatus != OversightReviewStatus.None;
            GatewayReviewStatus = application.GatewayReviewStatus;

            GatewayUserName = application.GatewayUserName;

            if (application.GatewayReviewStatus == RoatpGateway.Domain.GatewayReviewStatus.Pass)
            {
                IsGatewayApproved = true;
            }
            else if (application.GatewayReviewStatus == RoatpGateway.Domain.GatewayReviewStatus.Fail)
            {
                IsGatewayApproved = false;
            }

            if (application.ApplyData?.ApplyDetails != null)
            {
                ApplicationReference = application.ApplyData.ApplyDetails.ReferenceNumber;
                ApplicationRoute     = application.ApplyData.ApplyDetails.ProviderRouteName;
                Ukprn            = application.ApplyData.ApplyDetails.UKPRN;
                OrganisationName = application.ApplyData.ApplyDetails.OrganisationName;
                SubmittedDate    = application.ApplyData.ApplyDetails.ApplicationSubmittedOn;

                if (application.ApplicationStatus == RoatpGateway.Domain.ApplicationStatus.Withdrawn)
                {
                    ApplicationClosedOn = application.ApplyData.ApplyDetails.ApplicationWithdrawnOn;
                    ApplicationClosedBy = application.ApplyData.ApplyDetails.ApplicationWithdrawnBy;
                }
                else if (application.ApplicationStatus == RoatpGateway.Domain.ApplicationStatus.Removed)
                {
                    ApplicationClosedOn = application.ApplyData.ApplyDetails.ApplicationRemovedOn;
                    ApplicationClosedBy = application.ApplyData.ApplyDetails.ApplicationRemovedBy;
                }
            }

            if (application.ApplyData?.GatewayReviewDetails != null)
            {
                GatewayOutcomeDateTime       = application.ApplyData.GatewayReviewDetails.OutcomeDateTime;
                GatewayReviewComment         = application.ApplyData.GatewayReviewDetails.Comments;
                GatewayReviewExternalComment = application.ApplyData.GatewayReviewDetails.ExternalComments;
            }

            ApplicationComments         = application.Comments;
            ApplicationExternalComments = application.ExternalComments;
        }
Exemplo n.º 4
0
        public void Check_pending_results_are_as_expected()
        {
            var applicationDetails = new ApplicationOversightDetails
            {
                Id                         = Guid.NewGuid(),
                ApplicationId              = applicationId,
                OrganisationName           = "XXX Limited",
                Ukprn                      = "12344321",
                ProviderRoute              = "Main",
                ApplicationReferenceNumber = "APR000111",
                ApplicationSubmittedDate   = DateTime.Today.AddDays(-1),
                OversightStatus            = OversightReviewStatus.Successful,
                ApplicationStatus          = ApplicationStatus.Approved,
                ApplicationDeterminedDate  = DateTime.Today
            };

            OversightReviewQueries.Setup(r => r.GetOversightApplicationDetails(applicationId)).ReturnsAsync(applicationDetails);

            var result = _handler.Handle(new GetOversightApplicationDetailsRequest(applicationId), new CancellationToken()).GetAwaiter().GetResult();

            Assert.That(applicationDetails, Is.SameAs(result));
        }