Пример #1
0
        public async Task SaveCalculation_OnInvalidModel_ThenBadRequestReturned()
        {
            // Arrange
            ICalculationsApiClient calcsClient = Substitute.For <ICalculationsApiClient>();
            IMapper mapper = MappingHelper.CreateFrontEndMapper();

            string specificationId = "1";
            string calculationId   = "5";

            IAuthorizationHelper  authorizationHelper = TestAuthHelper.CreateAuthorizationHelperSubstitute(specificationId, SpecificationActionTypes.CanEditCalculations);
            CalculationController controller          = CreateCalculationController(calcsClient, mapper, authorizationHelper);

            CalculationUpdateViewModel updateViewModel = new CalculationUpdateViewModel()
            {
                SourceCode = null,
            };

            // Force validation failed
            controller.ModelState.AddModelError(nameof(updateViewModel.SourceCode), "Test");

            // Act
            IActionResult result = await controller.SaveCalculation(specificationId, calculationId, updateViewModel);

            // Assert
            result.Should().NotBeNull();
            result.Should().BeOfType <BadRequestObjectResult>();
        }
Пример #2
0
        public void EditCalculationStatus_GivenFailedStatusCode_ThrowsInvalidOperationException()
        {
            //Arrange
            string specificationId = "abc123";
            string calculationId   = "5";

            PublishStatusEditModel model = new PublishStatusEditModel();

            ValidatedApiResponse <PublishStatusResult> response = new ValidatedApiResponse <PublishStatusResult>(HttpStatusCode.BadRequest);

            ICalculationsApiClient calcsClient = Substitute.For <ICalculationsApiClient>();

            calcsClient
            .UpdatePublishStatus(Arg.Is(calculationId), Arg.Is(model))
            .Returns(response);

            IMapper mapper = MappingHelper.CreateFrontEndMapper();

            IAuthorizationHelper  authorizationHelper = TestAuthHelper.CreateAuthorizationHelperSubstitute(specificationId, SpecificationActionTypes.CanEditCalculations);
            CalculationController controller          = CreateCalculationController(calcsClient, mapper, authorizationHelper);

            // Act
            Func <Task> test = async() => await controller.EditCalculationStatus(specificationId, calculationId, model);

            // Assert
            test
            .Should()
            .Throw <InvalidOperationException>();
        }
Пример #3
0
        public void CompilePreview_OnBackendError_ThenExceptionThrown()
        {
            // Arrange
            string calculationId   = "5";
            string specificationId = "65";

            ICalculationsApiClient calcsClient = Substitute.For <ICalculationsApiClient>();
            IMapper mapper = MappingHelper.CreateFrontEndMapper();

            IAuthorizationHelper  authorizationHelper = TestAuthHelper.CreateAuthorizationHelperSubstitute(specificationId, SpecificationActionTypes.CanEditCalculations);
            CalculationController controller          = CreateCalculationController(calcsClient, mapper, authorizationHelper, resultsApiClient);

            PreviewCompileRequestViewModel previewViewModel = new PreviewCompileRequestViewModel()
            {
                SourceCode = "Updated source code",
            };

            calcsClient
            .PreviewCompile(Arg.Any <PreviewRequest>())
            .Returns(Task.FromResult(new ApiResponse <PreviewResponse>(HttpStatusCode.ServiceUnavailable, null)));

            CalculationUpdateViewModel updateViewModel = new CalculationUpdateViewModel()
            {
                SourceCode = "Source code",
            };

            // Act
            Action a = new Action(() =>
            {
                IActionResult result = controller.CompilePreview(specificationId, calculationId, previewViewModel).Result;
            });

            // Assert
            a.Should().Throw <InvalidOperationException>();
        }
Пример #4
0
        public async Task EditCalculationStatus_GivenOKResponseFromApi_ReturnsOK()
        {
            //Arrange
            string specificationId = "abc123";
            string calculationId   = "5";

            PublishStatusEditModel model = new PublishStatusEditModel();

            PublishStatusResult publishStatusResult = new PublishStatusResult();

            ValidatedApiResponse <PublishStatusResult> response = new ValidatedApiResponse <PublishStatusResult>(HttpStatusCode.OK, publishStatusResult);

            ICalculationsApiClient calcsClient = Substitute.For <ICalculationsApiClient>();

            calcsClient
            .UpdatePublishStatus(Arg.Is(calculationId), Arg.Is(model))
            .Returns(response);

            IMapper mapper = MappingHelper.CreateFrontEndMapper();

            IAuthorizationHelper  authorizationHelper = TestAuthHelper.CreateAuthorizationHelperSubstitute(specificationId, SpecificationActionTypes.CanEditCalculations);
            CalculationController controller          = CreateCalculationController(calcsClient, mapper, authorizationHelper);

            // Act
            IActionResult result = await controller.EditCalculationStatus(specificationId, calculationId, model);

            // Assert
            result
            .Should()
            .BeOfType <OkObjectResult>()
            .Which
            .Value
            .Should()
            .Be(publishStatusResult);
        }
Пример #5
0
        public void EditSpecificationStatus_GivenFailedStatusCode_ThrowsInvalidOperationException()
        {
            //Arrange
            string specificationId = "5";

            PublishStatusEditModel model = new PublishStatusEditModel();

            ValidatedApiResponse <PublishStatusResult> response = new ValidatedApiResponse <PublishStatusResult>(HttpStatusCode.BadRequest);

            ISpecsApiClient specsClient = Substitute.For <ISpecsApiClient>();

            specsClient
            .UpdatePublishStatus(Arg.Is(specificationId), Arg.Is(model))
            .Returns(response);

            IAuthorizationHelper    authorizationHelper = TestAuthHelper.CreateAuthorizationHelperSubstitute(specificationId, SpecificationActionTypes.CanApproveSpecification);
            SpecificationController controller          = CreateSpecificationController(specsClient, authorizationHelper);

            // Act
            Func <Task> test = async() => await controller.EditSpecificationStatus(specificationId, model);

            // Assert
            test
            .Should()
            .Throw <InvalidOperationException>();
        }
Пример #6
0
        public async Task EditSpecificationStatus_GivenSuccessReturnedFromApi_ReturnsOK()
        {
            //Arrange
            string specificationId = "5";

            PublishStatusEditModel model = new PublishStatusEditModel();

            PublishStatusResult publishStatusResult = new PublishStatusResult();

            ValidatedApiResponse <PublishStatusResult> response = new ValidatedApiResponse <PublishStatusResult>(HttpStatusCode.OK, publishStatusResult);

            ISpecsApiClient specsClient = Substitute.For <ISpecsApiClient>();

            specsClient
            .UpdatePublishStatus(Arg.Is(specificationId), Arg.Is(model))
            .Returns(response);

            IAuthorizationHelper    authorizationHelper = TestAuthHelper.CreateAuthorizationHelperSubstitute(specificationId, SpecificationActionTypes.CanApproveSpecification);
            SpecificationController controller          = CreateSpecificationController(specsClient, authorizationHelper);

            // Act
            IActionResult result = await controller.EditSpecificationStatus(specificationId, model);

            // Assert
            result
            .Should()
            .BeOfType <OkObjectResult>()
            .Which
            .Value
            .Should()
            .Be(publishStatusResult);
        }
Пример #7
0
        public async Task CompilePreview_OnInvalidModel_ThenBadRequestReturned()
        {
            // Arrange
            ICalculationsApiClient calcsClient = Substitute.For <ICalculationsApiClient>();
            IMapper mapper = MappingHelper.CreateFrontEndMapper();

            string calculationId   = "5";
            string specificationId = "65";

            IAuthorizationHelper  authorizationHelper = TestAuthHelper.CreateAuthorizationHelperSubstitute(specificationId, SpecificationActionTypes.CanEditCalculations);
            CalculationController controller          = CreateCalculationController(calcsClient, mapper, authorizationHelper);

            PreviewCompileRequestViewModel previewViewModel = new PreviewCompileRequestViewModel()
            {
                SourceCode = "Updated source code",
            };

            // Force validation failed
            controller.ModelState.AddModelError(nameof(previewViewModel.SourceCode), "Test");

            // Act
            IActionResult result = await controller.CompilePreview(specificationId, calculationId, previewViewModel);

            // Assert
            result.Should().NotBeNull();
            result.Should().BeOfType <BadRequestObjectResult>();

            await authorizationHelper
            .DidNotReceive()
            .DoesUserHavePermission(Arg.Any <ClaimsPrincipal>(), Arg.Any <string>(), Arg.Any <SpecificationActionTypes>());
        }
Пример #8
0
        public void SaveCalculation_OnBackendError_ThenExceptionThrown()
        {
            // Arrange
            ICalculationsApiClient calcsClient = Substitute.For <ICalculationsApiClient>();
            IMapper mapper = MappingHelper.CreateFrontEndMapper();

            string specificationId = "1";
            string calculationId   = "5";

            IAuthorizationHelper  authorizationHelper = TestAuthHelper.CreateAuthorizationHelperSubstitute(specificationId, SpecificationActionTypes.CanEditCalculations);
            CalculationController controller          = CreateCalculationController(calcsClient, mapper, authorizationHelper);

            calcsClient
            .UpdateCalculation(calculationId, Arg.Any <CalculationUpdateModel>())
            .Returns(Task.FromResult(new ApiResponse <Calculation>(System.Net.HttpStatusCode.ServiceUnavailable, null)));

            CalculationUpdateViewModel updateViewModel = new CalculationUpdateViewModel()
            {
                SourceCode = "Source code",
            };

            // Act
            Action a = new Action(() =>
            {
                IActionResult result = controller.SaveCalculation(specificationId, calculationId, updateViewModel).Result;
            });

            // Assert
            a.Should().Throw <InvalidOperationException>();
        }
        private static SelectSourceDatasetPageModel CreatePageModel(IDatasetsApiClient datasetClient = null, ILogger logger = null, IAuthorizationHelper authorizationHelper = null)
        {
            SelectSourceDatasetPageModel pageModel = new SelectSourceDatasetPageModel(datasetClient ?? CreateDatasetsApiClient(), logger ?? CreateLogger(), authorizationHelper ?? TestAuthHelper.CreateAuthorizationHelperSubstitute(SpecificationActionTypes.CanMapDatasets));

            pageModel.PageContext = TestAuthHelper.CreatePageContext();

            return(pageModel);
        }
        private static CreateSpecificationPageModel CreatePageModel(ISpecsApiClient specsClient = null, IMapper mapper = null, IAuthorizationHelper authorizationHelper = null)
        {
            CreateSpecificationPageModel pageModel = new CreateSpecificationPageModel(specsClient ?? CreateApiClient(), mapper ?? CreateMapper(), authorizationHelper ?? TestAuthHelper.CreateAuthorizationHelperSubstitute(Common.Identity.Authorization.Models.SpecificationActionTypes.CanEditSpecification));

            pageModel.PageContext = TestAuthHelper.CreatePageContext();

            return(pageModel);
        }
        static CreateCalculationPageModel CreatePageModel(ISpecsApiClient specsClient = null, IMapper mapper = null, IAuthorizationHelper authorizationHelper = null, IFeatureToggle featureToggle = null)
        {
            CreateCalculationPageModel pageModel = new CreateCalculationPageModel(
                specsClient ?? CreateSpecsApiClient(),
                mapper ?? CreateMapper(),
                authorizationHelper ?? TestAuthHelper.CreateAuthorizationHelperSubstitute(SpecificationActionTypes.CanEditSpecification),
                featureToggle ?? CreateFeatureToggle());

            pageModel.PageContext = TestAuthHelper.CreatePageContext();
            return(pageModel);
        }
        private ApprovalController CreateApprovalController(IResultsApiClient resultsClient          = null,
                                                            ISpecsApiClient specsClient              = null,
                                                            IAuthorizationHelper authorizationHelper = null)
        {
            IMapper mapper = Substitute.For <IMapper>();

            return(new ApprovalController(
                       resultsClient ?? CreateResultsClient(),
                       specsClient ?? CreateSpecsClient(),
                       mapper,
                       authorizationHelper ?? TestAuthHelper.CreateAuthorizationHelperSubstitute(SpecificationActionTypes.CanApproveFunding)));
        }
Пример #13
0
        public async Task SaveCalculation_OnSuccessfulSaveRequest_ThenResponseSentToClient()
        {
            // Arrange
            ICalculationsApiClient calcsClient = Substitute.For <ICalculationsApiClient>();
            IMapper mapper = MappingHelper.CreateFrontEndMapper();

            string specificationId = "1";
            string calculationId   = "5";

            IAuthorizationHelper  authorizationHelper = TestAuthHelper.CreateAuthorizationHelperSubstitute(specificationId, SpecificationActionTypes.CanEditCalculations);
            CalculationController controller          = CreateCalculationController(calcsClient, mapper, authorizationHelper, resultsApiClient);

            CalculationUpdateViewModel updateViewModel = new CalculationUpdateViewModel()
            {
                SourceCode = "Updated source code"
            };

            Calculation existingCalculation = new Calculation()
            {
                Id = calculationId,
                SpecificationId = specificationId,
                SourceCode      = "Existing source code"
            };

            calcsClient
            .GetCalculationById(Arg.Is(calculationId))
            .Returns(new ApiResponse <Calculation>(HttpStatusCode.OK, existingCalculation));

            Calculation apiResultCalculation = new Calculation()
            {
                Id = calculationId,
                SpecificationId = specificationId,
                SourceCode      = updateViewModel.SourceCode
            };

            calcsClient
            .EditCalculation(specificationId, calculationId, Arg.Any <CalculationEditModel>())
            .Returns(new ValidatedApiResponse <Common.ApiClient.Calcs.Models.Calculation>(HttpStatusCode.OK, apiResultCalculation));

            // Act
            IActionResult result = await controller.SaveCalculation(specificationId, calculationId, updateViewModel);

            // Assert
            result.Should().NotBeNull();
            result.Should().BeOfType <OkObjectResult>();

            OkObjectResult typedResult       = result as OkObjectResult;
            Calculation    resultCalculation = typedResult.Value as Calculation;

            resultCalculation?.SourceCode.Should().Be(updateViewModel.SourceCode);
        }
Пример #14
0
 private static EditTestScenarioPageModel CreatePageModel(
     ISpecsApiClient specsApiClient         = null,
     IScenariosApiClient scenariosApiClient = null,
     IMapper mapper = null,
     ILogger logger = null,
     IAuthorizationHelper authorizationHelper = null)
 {
     return(new EditTestScenarioPageModel(
                specsApiClient ?? CreateSpecsApiClient(),
                scenariosApiClient ?? CreateScenarioApiClient(),
                mapper ?? CreateMapper(),
                logger ?? CreateLogger(),
                authorizationHelper ?? TestAuthHelper.CreateAuthorizationHelperSubstitute(SpecificationActionTypes.CanEditQaTests)));
 }
 private PoliciesModel GetPoliciesModel(
     ISpecsApiClient specsApiClient       = null,
     IDatasetsApiClient datasetsApiClient = null,
     ILogger logger = null,
     IAuthorizationHelper authorizationHelper = null
     )
 {
     return(new PoliciesModel(
                specsApiClient ?? CreateSpecsApiClient(),
                datasetsApiClient ?? CreateDatasetsApiClient(),
                logger ?? CreateLogger(),
                MappingHelper.CreateFrontEndMapper(),
                authorizationHelper ?? TestAuthHelper.CreateAuthorizationHelperSubstitute(SpecificationActionTypes.CanApproveSpecification)));
 }
Пример #16
0
        public static EditCalculationPageModel CreatePageModel(
            ISpecsApiClient specsClient = null,
            ILogger logger = null,
            IMapper mapper = null,
            IAuthorizationHelper authorizationHelper = null)
        {
            EditCalculationPageModel pageModel = new EditCalculationPageModel(
                specsClient ?? CreateSpecsClient(),
                logger ?? CreateLogger(),
                mapper ?? MappingHelper.CreateFrontEndMapper(),
                authorizationHelper ?? TestAuthHelper.CreateAuthorizationHelperSubstitute(SpecificationActionTypes.CanEditSpecification));

            pageModel.PageContext = TestAuthHelper.CreatePageContext();
            return(pageModel);
        }
Пример #17
0
        public void RedirectToEditCalc_WhenAParameterIsNull_ShouldThrowException()
        {
            // Arrange
            ICalculationsApiClient mockCalculationApiClient = Substitute.For <ICalculationsApiClient>();
            IAuthorizationHelper   mockAuthorizationHelper  = TestAuthHelper.CreateAuthorizationHelperSubstitute("doesnt matter", SpecificationActionTypes.CanApproveSpecification);
            IMapper mockMapper = Substitute.For <IMapper>();

            CalculationController controller = new CalculationController(mockCalculationApiClient, mockMapper, mockAuthorizationHelper);

            // Act
            Func <Task <IActionResult> > redirectToEditCalc = async() => await controller.RedirectToEditCalc(null);

            // Assert
            redirectToEditCalc.Should().Throw <ArgumentException>();
        }
Пример #18
0
        public async Task CompilePreview_OnSuccessfulSaveRequest_ThenResponseSentToClient()
        {
            // Arrange
            ICalculationsApiClient calcsClient = Substitute.For <ICalculationsApiClient>();
            IMapper mapper = MappingHelper.CreateFrontEndMapper();

            string calculationId   = "5";
            string specificationId = "65";

            IAuthorizationHelper  authorizationHelper = TestAuthHelper.CreateAuthorizationHelperSubstitute(specificationId, SpecificationActionTypes.CanEditCalculations);
            CalculationController controller          = CreateCalculationController(calcsClient, mapper, authorizationHelper);

            PreviewCompileRequestViewModel previewViewModel = new PreviewCompileRequestViewModel()
            {
                SourceCode = "Updated source code",
            };

            PreviewCompileResult apiResultCalculation = new PreviewCompileResult()
            {
                CompilerOutput = new CompilerOutput()
                {
                    Success = true,
                }
            };

            calcsClient
            .PreviewCompile(Arg.Any <PreviewCompileRequest>())
            .Returns(new ApiResponse <PreviewCompileResult>(System.Net.HttpStatusCode.OK, apiResultCalculation));

            // Act
            IActionResult result = await controller.CompilePreview(specificationId, calculationId, previewViewModel);

            // Assert
            result.Should().NotBeNull();
            result.Should().BeOfType <OkObjectResult>();

            OkObjectResult       typedResult   = result as OkObjectResult;
            PreviewCompileResult previewResult = typedResult.Value as PreviewCompileResult;

            previewResult.CompilerOutput.Success.Should().Be(apiResultCalculation.CompilerOutput.Success);

            await authorizationHelper
            .DidNotReceive()
            .DoesUserHavePermission(Arg.Any <ClaimsPrincipal>(), Arg.Any <string>(), Arg.Any <SpecificationActionTypes>());
        }
        private static EditCalculationPageModel CreatePageModel(
            ISpecsApiClient specsClient        = null,
            ICalculationsApiClient calcsClient = null,
            IMapper mapper          = null,
            IFeatureToggle features = null,
            IAuthorizationHelper authorizationHelper = null,
            IResultsApiClient resultsApiClient       = null)
        {
            EditCalculationPageModel pageModel = new EditCalculationPageModel(
                specsClient ?? CreateSpecsApiClient(),
                calcsClient ?? CreateCalcsApiClient(),
                mapper ?? CreateMapper(),
                features ?? CreateFeatureToggle(),
                authorizationHelper ?? TestAuthHelper.CreateAuthorizationHelperSubstitute(SpecificationActionTypes.CanEditCalculations),
                resultsApiClient ?? CreateResultsApiClient());

            pageModel.PageContext = TestAuthHelper.CreatePageContext();
            return(pageModel);
        }
        public async Task OnGetAsync_GivenUserDoesNotHaveMapDatasetsPermission_ThenReturnPageResultWithAuthorizedToEditFlagSetToFalse()
        {
            // Arrange
            SelectDataSourceModel sourceModel = new SelectDataSourceModel();

            sourceModel.Datasets = new[]
            {
                new DatasetVersionsModel
                {
                    Id       = "ds-id",
                    Name     = "ds name",
                    Versions = new[] { 1 }
                }
            };

            ApiResponse <SelectDataSourceModel> sourcesResponse = new ApiResponse <SelectDataSourceModel>(HttpStatusCode.OK, sourceModel);

            IDatasetsApiClient datasetsApiClient = CreateDatasetsApiClient();

            datasetsApiClient
            .GetDatasourcesByRelationshipId(Arg.Is(relationshipId))
            .Returns(sourcesResponse);

            ILogger logger = CreateLogger();

            IAuthorizationHelper         mockAuthorizationHelper = TestAuthHelper.CreateAuthorizationHelperSubstitute(SpecificationActionTypes.CanMapDatasets, false);
            SelectSourceDatasetPageModel pageModel = CreatePageModel(datasetsApiClient, logger, authorizationHelper: mockAuthorizationHelper);

            // Act
            IActionResult result = await pageModel.OnGetAsync(relationshipId);

            //Assert
            result
            .Should()
            .BeOfType <PageResult>();

            pageModel
            .IsAuthorizedToMap
            .Should().BeFalse();
        }
Пример #21
0
        public async Task RedirectToEditCalc_WhenValidRequestAndCalculationIsFound_ShouldRedirectToEditCalculationPage()
        {
            // Arrange
            const string calculationSpecificationId = "calcSpecId";
            const string calculationIdReturned      = "Calc55";

            Calculation calculationReturned = new Calculation()
            {
                Id = calculationIdReturned
            };
            ValidatedApiResponse <Calculation> apiResponse = new ValidatedApiResponse <Calculation>(HttpStatusCode.OK, calculationReturned);

            ICalculationsApiClient mockCalculationApiClient = Substitute.For <ICalculationsApiClient>();

            mockCalculationApiClient
            .GetCalculationByCalculationSpecificationId(calculationSpecificationId)
            .Returns(apiResponse);

            IAuthorizationHelper mockAuthorizationHelper = TestAuthHelper.CreateAuthorizationHelperSubstitute("doesnt matter", SpecificationActionTypes.CanApproveSpecification);
            IMapper mockMapper = Substitute.For <IMapper>();

            CalculationController controller = new CalculationController(mockCalculationApiClient, mockMapper, mockAuthorizationHelper);

            // Act
            IActionResult actionResult = await controller.RedirectToEditCalc(calculationSpecificationId);

            // Assert
            actionResult
            .Should()
            .BeOfType <RedirectResult>();

            RedirectResult redirectResult = actionResult as RedirectResult;

            redirectResult
            .Url
            .Should()
            .EndWith($"calcs/editCalculation/{calculationIdReturned}");
        }
Пример #22
0
        public async Task EditCalculationStatus_GivenBadRequestStatusCodeFromApprovingCalc_ReturnsBadRequestObjectResponse()
        {
            //Arrange
            string specificationId = "abc123";
            string calculationId   = "5";

            PublishStatusEditModel model = new PublishStatusEditModel();


            ICalculationsApiClient calcsClient = Substitute.For <ICalculationsApiClient>();

            ValidatedApiResponse <PublishStatusResult> response = new ValidatedApiResponse <PublishStatusResult>(HttpStatusCode.BadRequest);

            calcsClient
            .UpdatePublishStatus(Arg.Is(calculationId), Arg.Is(model))
            .Returns(response);

            ValidatedApiResponse <Calculation> calculation = new ValidatedApiResponse <Calculation>(HttpStatusCode.OK, new Calculation()
            {
                FundingStreamId = "fs1", SpecificationId = specificationId
            });

            calcsClient
            .GetCalculationById(Arg.Is(calculationId))
            .Returns(calculation);

            IMapper mapper = MappingHelper.CreateFrontEndMapper();

            IAuthorizationHelper  authorizationHelper = TestAuthHelper.CreateAuthorizationHelperSubstitute(specificationId, SpecificationActionTypes.CanApproveAnyCalculations);
            CalculationController controller          = CreateCalculationController(calcsClient, mapper, authorizationHelper, resultsApiClient);

            IActionResult actionResult = await controller.ApproveCalculation(specificationId, calculationId, model);

            actionResult
            .Should()
            .BeOfType <BadRequestObjectResult>();
        }
Пример #23
0
        public void RedirectToEditCalc_WhenValidRequestButCalculationNotFoundResult_ShouldThrowException()
        {
            // Arrange
            const string calculationSpecificationId = "calcSpecId";

            ValidatedApiResponse <Calculation> apiResponse = new ValidatedApiResponse <Calculation>(HttpStatusCode.NotFound);

            ICalculationsApiClient calculationsApiClient = Substitute.For <ICalculationsApiClient>();

            calculationsApiClient
            .GetCalculationByCalculationSpecificationId(calculationSpecificationId)
            .Returns(apiResponse);

            IAuthorizationHelper mockAuthorizationHelper = TestAuthHelper.CreateAuthorizationHelperSubstitute("doesnt matter", SpecificationActionTypes.CanApproveSpecification);
            IMapper mockMapper = Substitute.For <IMapper>();

            CalculationController controller = new CalculationController(calculationsApiClient, mockMapper, mockAuthorizationHelper);

            // Act
            Func <Task <IActionResult> > redirectToEditCalc = async() => await controller.RedirectToEditCalc(calculationSpecificationId);

            // Assert
            redirectToEditCalc.Should().Throw <ApplicationException>();
        }