public void Arrange()
        {
            var autoFixture = new Fixture();

            _accountApiClient = new Mock <IAccountApiClient>();
            _informRequest    = autoFixture.Create <InformRequest>();

            _accountApiClient.Setup(x => x.GetTransferConnections(_informRequest.AccountHashedId))
            .ReturnsAsync(new List <TransferConnectionViewModel>
            {
                new TransferConnectionViewModel
                {
                    FundingEmployerAccountId       = 1234,
                    FundingEmployerAccountName     = "FirstAccountName",
                    FundingEmployerHashedAccountId = "FAN"
                },
                new TransferConnectionViewModel
                {
                    FundingEmployerAccountId       = 1235,
                    FundingEmployerAccountName     = "SecondAccountName",
                    FundingEmployerHashedAccountId = "SAN"
                }
            });

            _mapper = new InformRequestToSelectTransferConnectionViewModelMapper(_accountApiClient.Object);
        }
        public void Arrange()
        {
            var autoFixture = new Fixture();

            _informRequest = autoFixture.Create <InformRequest>();
            _mapper        = new InformRequestToInformViewModelMapper();
        }
        public async Task <IActionResult> SelectTransferConnection(InformRequest request)
        {
            var viewModel = await _modelMapper.Map <SelectTransferConnectionViewModel>(request);

            if (viewModel.TransferConnections.Any())
            {
                return(Redirect(_linkGenerator.SelectTransferConnection(request.AccountHashedId)));
            }

            return(Redirect(_linkGenerator.SelectLegalEntity(request.AccountHashedId)));
        }
Esempio n. 4
0
        public async Task <IActionResult> SelectTransferConnection(InformRequest request)
        {
            var viewModel = await _modelMapper.Map <SelectTransferConnectionViewModel>(request);

            if (viewModel.TransferConnections.Any())
            {
                return(View(viewModel));
            }

            return(RedirectToAction("SelectLegalEntity", new SelectLegalEntityRequest {
                AccountHashedId = request.AccountHashedId, transferConnectionCode = string.Empty
            }));
        }
        public void Arrange()
        {
            var autoFixture = new Fixture();

            _request   = autoFixture.Create <InformRequest>();
            _viewModel = autoFixture.Create <InformViewModel>();

            _modelMapper = new Mock <IModelMapper>();
            _modelMapper.Setup(x => x.Map <InformViewModel>(It.Is <InformRequest>(r => r == _request)))
            .ReturnsAsync(_viewModel);

            _controller = new CohortController(Mock.Of <ICommitmentsApiClient>(),
                                               Mock.Of <ILogger <CohortController> >(),
                                               Mock.Of <ILinkGenerator>(),
                                               _modelMapper.Object,
                                               Mock.Of <IAuthorizationService>());
        }
Esempio n. 6
0
        public async Task <ActionResult> Inform(InformRequest request)
        {
            var viewModel = await _modelMapper.Map <InformViewModel>(request);

            return(View(viewModel));
        }