public WhenMappingWithEmployerToViewModelFixture()
        {
            EncodingService      = new Mock <IEncodingService>();
            CommitmentsApiClient = new Mock <ICommitmentsApiClient>();

            WithEmployerRequest = new CohortsByProviderRequest()
            {
                ProviderId = ProviderId
            };
            GetCohortsResponse = CreateGetCohortsResponse();

            CommitmentsApiClient.Setup(c => c.GetCohorts(It.Is <GetCohortsRequest>(r => r.ProviderId == ProviderId), CancellationToken.None)).ReturnsAsync(GetCohortsResponse);
            EncodingService.Setup(x => x.Encode(It.IsAny <long>(), EncodingType.CohortReference)).Returns((long y, EncodingType z) => y + "_Encoded");

            ProviderRelationshipsApiClient = new Mock <IProviderRelationshipsApiClient>();

            PasAccountApiClient = new Mock <IPasAccountApiClient>();
            PasAccountApiClient.Setup(x => x.GetAgreement(It.IsAny <long>(), It.IsAny <CancellationToken>())).ReturnsAsync(() => new ProviderAgreement {
                Status = ProviderAgreementStatus.Agreed
            });

            UrlHelper = new Mock <IUrlHelper>();
            UrlHelper.Setup(x => x.Action(It.IsAny <UrlActionContext>())).Returns <UrlActionContext>((ac) => $"http://{ac.Controller}/{ac.Action}/");

            Mapper = new WithEmployerViewModelMapper(CommitmentsApiClient.Object, ProviderRelationshipsApiClient.Object, UrlHelper.Object, PasAccountApiClient.Object, EncodingService.Object);
        }
コード例 #2
0
        public async Task <IActionResult> WithTransferSender(CohortsByProviderRequest request)
        {
            var withTransferSenderViewModel = await _modelMapper.Map <WithTransferSenderViewModel>(request);

            withTransferSenderViewModel.SortedByHeader();

            return(View(withTransferSenderViewModel));
        }
コード例 #3
0
        public async Task <IActionResult> Draft(CohortsByProviderRequest request)
        {
            var draftViewModel = await _modelMapper.Map <DraftViewModel>(request);

            draftViewModel.SortedByHeader();

            return(View(draftViewModel));
        }
コード例 #4
0
        public async Task <IActionResult> Review(CohortsByProviderRequest request)
        {
            var reviewViewModel = await _modelMapper.Map <ReviewViewModel>(request);

            reviewViewModel.SortedByHeader();

            return(View(reviewViewModel));
        }
コード例 #5
0
        public WhenMappingTransferSenderRequestToViewModelFixture()
        {
            WithTransferSenderRequest = new CohortsByProviderRequest {
                ProviderId = ProviderId
            };
            EncodingService      = new Mock <IEncodingService>();
            CommitmentsApiClient = new Mock <ICommitmentsApiClient>();

            GetCohortsResponse = CreateGetCohortsResponse();

            CommitmentsApiClient.Setup(c => c.GetCohorts(It.Is <GetCohortsRequest>(r => r.ProviderId == ProviderId), CancellationToken.None)).ReturnsAsync(GetCohortsResponse);
            EncodingService.Setup(x => x.Encode(It.IsAny <long>(), EncodingType.CohortReference)).Returns((long y, EncodingType z) => y + "_Encoded");

            Mapper = new WithTransferSenderRequestViewModelMapper(CommitmentsApiClient.Object, EncodingService.Object);
        }
コード例 #6
0
        public WhenGettingCohortsFixture()
        {
            Request                     = new CohortsByProviderRequest();
            ModelMapperMock             = new Mock <IModelMapper>();
            CohortsViewModel            = new CohortsViewModel();
            ReviewViewModel             = new ReviewViewModel();
            DraftViewModel              = new DraftViewModel();
            WithTransferSenderViewModel = new WithTransferSenderViewModel();

            ModelMapperMock.Setup(x => x.Map <CohortsViewModel>(Request)).ReturnsAsync(CohortsViewModel);
            ModelMapperMock.Setup(x => x.Map <ReviewViewModel>(Request)).ReturnsAsync(ReviewViewModel);
            ModelMapperMock.Setup(x => x.Map <DraftViewModel>(Request)).ReturnsAsync(DraftViewModel);
            ModelMapperMock.Setup(x => x.Map <WithTransferSenderViewModel>(Request)).ReturnsAsync(WithTransferSenderViewModel);

            Sut = new CohortController(Mock.Of <IMediator>(), ModelMapperMock.Object, Mock.Of <ILinkGenerator>(), Mock.Of <ICommitmentsApiClient>());
        }
        public async Task <IActionResult> WithEmployer(CohortsByProviderRequest request)
        {
            var withEmployerViewModel = await _modelMapper.Map <WithEmployerViewModel>(request);

            return(View(withEmployerViewModel));
        }
        public async Task <IActionResult> Cohorts(CohortsByProviderRequest request)
        {
            var model = await _modelMapper.Map <CohortsViewModel>(request);

            return(View(model));
        }