public void ViewModelToRequested_GivenValidViewModel_RequestShouldNotBeNull()
        {
            var categoryValues = new NonObligatedCategoryValues();

            var viewModel = new NonObligatedValuesViewModel(categoryValues, calculator);

            var request = requestCreator.ViewModelToRequest(viewModel);

            request.Should().NotBeNull();
        }
        public async void IndexPost_GivenValidViewModel_ApiSendShouldBeCalled()
        {
            var model   = new NonObligatedValuesViewModel(calculator);
            var request = new AddNonObligated();

            A.CallTo(() => requestCreator.ViewModelToRequest(model)).Returns(request);

            await controller.Index(model);

            A.CallTo(() => weeeClient.SendAsync(A <string> ._, request)).MustHaveHappened(Repeated.Exactly.Once);
        }
Exemplo n.º 3
0
        public virtual async Task <ActionResult> Index(NonObligatedValuesViewModel viewModel)
        {
            using (var client = apiClient())
            {
                if (ModelState.IsValid)
                {
                    var request = requestCreator.ViewModelToRequest(viewModel);

                    await client.SendAsync(User.GetAccessToken(), request);

                    return(RedirectToAction("Index", "AatfTaskList", new { area = "AatfReturn", organisationId = viewModel.OrganisationId, returnId = viewModel.ReturnId }));
                }

                await SetBreadcrumb(viewModel.OrganisationId, BreadCrumbConstant.AatfReturn, DisplayHelper.YearQuarterPeriodFormat(TempData["currentQuarter"] as Quarter, TempData["currentQuarterWindow"] as QuarterWindow));

                return(View(viewModel));
            }
        }