Exemple #1
0
        public async Task <SubcontractorDeclaration> GetSubcontractorDeclaration(Guid applicationId)
        {
            var hasDeliveredTrainingAsSubcontractorTask = _qnaApiClient.GetAnswerValue(applicationId,
                                                                                       RoatpWorkflowSequenceIds.YourOrganisation,
                                                                                       RoatpWorkflowSectionIds.YourOrganisation.ExperienceAndAccreditations,
                                                                                       RoatpWorkflowPageIds.ExperienceAndAccreditations.SubcontractorDeclaration,
                                                                                       RoatpYourOrganisationQuestionIdConstants.HasDeliveredTrainingAsSubcontractor
                                                                                       );

            var contactFileNameTask = _qnaApiClient.GetAnswerValue(applicationId,
                                                                   RoatpWorkflowSequenceIds.YourOrganisation,
                                                                   RoatpWorkflowSectionIds.YourOrganisation.ExperienceAndAccreditations,
                                                                   RoatpWorkflowPageIds.ExperienceAndAccreditations.SubcontractorContractFile,
                                                                   RoatpYourOrganisationQuestionIdConstants.ContractFileName
                                                                   );

            await Task.WhenAll(hasDeliveredTrainingAsSubcontractorTask, contactFileNameTask);

            var result = new SubcontractorDeclaration
            {
                HasDeliveredTrainingAsSubcontractor = hasDeliveredTrainingAsSubcontractorTask.Result?.ToUpper() == "YES",
                ContractFileName = contactFileNameTask.Result
            };

            return(result);
        }
        public void check_subcontractor_declaration_details_are_returned()
        {
            var subcontractorDeclaration = new SubcontractorDeclaration {
                HasDeliveredTrainingAsSubcontractor = true, ContractFileName = "fileName"
            };

            ExperienceAndAccreditationApiClient.Setup(x => x.GetSubcontractorDeclaration(ApplicationId)).ReturnsAsync(subcontractorDeclaration);

            var request  = new GetSubcontractorDeclarationRequest(ApplicationId, UserId, UserName);
            var response = Orchestrator.GetSubcontractorDeclarationViewModel(request);

            var viewModel = response.Result;

            Assert.AreEqual(GatewayPageIds.SubcontractorDeclaration, viewModel.PageId);
            AssertCommonDetails(viewModel);
            Assert.AreEqual(subcontractorDeclaration.HasDeliveredTrainingAsSubcontractor, viewModel.HasDeliveredTrainingAsSubcontractor);
            Assert.AreEqual(subcontractorDeclaration.ContractFileName, viewModel.ContractFileName);
        }