public void SetUp()
 {
     _controller = new PingController()
     {
         ControllerContext = MockedControllerContext.Setup()
     };
 }
Example #2
0
 public void SetUp()
 {
     _controller = new ErrorPageController()
     {
         ControllerContext = MockedControllerContext.Setup()
     };
 }
Example #3
0
 public void Setup()
 {
     _controller = new AccountController(Mock.Of <ILogger <AccountController> >())
     {
         ControllerContext = MockedControllerContext.Setup(),
         Url = Mock.Of <IUrlHelper>()
     };
 }
 public void SetUp()
 {
     _configuration = new Mock <IWebConfiguration>();
     _controller    = new HomeController(_configuration.Object)
     {
         ControllerContext = MockedControllerContext.Setup()
     };
 }
        public void SetUp()
        {
            _orchestrator = new Mock <IOutcomeOverviewOrchestrator>();

            _controller = new OutcomeOverviewController(_orchestrator.Object)
            {
                ControllerContext = MockedControllerContext.Setup()
            };
        }
        public void Before_each_test()
        {
            _applicationApplyApiClient = new Mock <IRoatpApplicationApiClient>();

            _controller = new RoatpAllowedProvidersController(_applicationApplyApiClient.Object)
            {
                ControllerContext = MockedControllerContext.Setup()
            };
        }
 public void SetUp()
 {
     _dashboardUrl  = "https://dashboard";
     _configuration = new Mock <IWebConfiguration>();
     _configuration.Setup(c => c.EsfaAdminServicesBaseUrl).Returns(_dashboardUrl);
     _controller = new HomeController(_configuration.Object)
     {
         ControllerContext = MockedControllerContext.Setup()
     };
 }
Example #8
0
        public void Setup()
        {
            CoreSetup();

            _orchestrator = new Mock <IGatewayCriminalComplianceChecksOrchestrator>();
            _controller   = new RoatpCriminalComplianceChecksController(ApplyApiClient.Object, GatewayValidator.Object, _orchestrator.Object, Logger.Object);

            _controller.ControllerContext = MockedControllerContext.Setup();
            UserId   = _controller.ControllerContext.HttpContext.User.UserId();
            Username = _controller.ControllerContext.HttpContext.User.UserDisplayName();
        }
        public void Setup()
        {
            CoreSetup();

            _orchestrator = new Mock <IGatewayExperienceAndAccreditationOrchestrator>();
            _controller   = new RoatpGatewayExperienceAndAccreditationController(ApplyApiClient.Object, GatewayValidator.Object, _orchestrator.Object, Logger.Object);

            _controller.ControllerContext = MockedControllerContext.Setup();
            UserId   = _controller.ControllerContext.HttpContext.User.UserId();
            Username = _controller.ControllerContext.HttpContext.User.UserDisplayName();
        }
Example #10
0
        public void SetUp()
        {
            _assessorOverviewOrchestrator = new Mock <IAssessorOverviewOrchestrator>();

            _controller = new AssessorOverviewController(_assessorOverviewOrchestrator.Object)
            {
                ControllerContext = MockedControllerContext.Setup()
            };

            _applicationViewModel = GetApplicationViewModel();
            _assessorOverviewOrchestrator.Setup(x => x.GetOverviewViewModel(It.IsAny <GetAssessorOverviewRequest>())).ReturnsAsync(_applicationViewModel);
        }
        public void SetUp()
        {
            _clarificationApiClient     = new Mock <IRoatpClarificationApiClient>();
            _clarificationPageValidator = new Mock <IClarificationPageValidator>();
            _sectionReviewOrchestrator  = new Mock <IClarificationSectionReviewOrchestrator>();

            var logger = Mock.Of <ILogger <ClarificationSectionReviewController> >();

            _controller = new ClarificationSectionReviewController(_clarificationApiClient.Object, _clarificationPageValidator.Object, _sectionReviewOrchestrator.Object, logger)
            {
                ControllerContext = MockedControllerContext.Setup()
            };
        }
        public void SetUp()
        {
            _moderationApiClient       = new Mock <IRoatpModerationApiClient>();
            _moderatorPageValidator    = new Mock <IModeratorPageValidator>();
            _sectionReviewOrchestrator = new Mock <IModeratorSectionReviewOrchestrator>();

            var logger = Mock.Of <ILogger <ModeratorSectionReviewController> >();

            _controller = new ModeratorSectionReviewController(_moderationApiClient.Object, _moderatorPageValidator.Object, _sectionReviewOrchestrator.Object, logger)
            {
                ControllerContext = MockedControllerContext.Setup()
            };
        }
Example #13
0
        public void Setup()
        {
            _dashboardUrl = "https://dashboard";

            _assessorOrchestrator      = new Mock <IAssessorDashboardOrchestrator>();
            _moderatorOrchestrator     = new Mock <IModeratorDashboardOrchestrator>();
            _clarificationOrchestrator = new Mock <IClarificationDashboardOrchestrator>();
            _outcomeOrchestrator       = new Mock <IOutcomeDashboardOrchestrator>();
            _controller = new DashboardController(_assessorOrchestrator.Object, _moderatorOrchestrator.Object, _clarificationOrchestrator.Object, _outcomeOrchestrator.Object)
            {
                ControllerContext = MockedControllerContext.Setup()
            };
        }
        public void SetUp()
        {
            _assessorApiClient         = new Mock <IRoatpAssessorApiClient>();
            _assessorPageValidator     = new Mock <IAssessorPageValidator>();
            _sectionReviewOrchestrator = new Mock <IAssessorSectionReviewOrchestrator>();

            var logger = Mock.Of <ILogger <AssessorSectionReviewController> >();

            _controller = new AssessorSectionReviewController(_assessorApiClient.Object, _assessorPageValidator.Object, _sectionReviewOrchestrator.Object, logger)
            {
                ControllerContext = MockedControllerContext.Setup()
            };
        }
        public void SetUp()
        {
            _mockOrchestrator = new Mock<IClarificationOutcomeOrchestrator>();
            _mockValidator = new Mock<IClarificationOutcomeValidator>();
            _mockModerationApiClient = new Mock<IRoatpModerationApiClient>();
            _controller = new ClarificationOutcomeController(_mockOrchestrator.Object, _mockValidator.Object, _mockModerationApiClient.Object, Mock.Of<ILogger<ClarificationOutcomeController>>())
            {
                ControllerContext = MockedControllerContext.Setup()
            };

            _outcomeViewModel = GetOutcomeViewModel();
            _mockOrchestrator.Setup(x => x.GetClarificationOutcomeViewModel(It.IsAny<GetClarificationOutcomeRequest>()))
                .ReturnsAsync(_outcomeViewModel);
        }
        public void Setup()
        {
            CoreSetup();

            _applicationActionsOrchestrator = new Mock <IGatewayApplicationActionsOrchestrator>();
            _removeApplicationValidator     = new Mock <IRoatpRemoveApplicationViewModelValidator>();
            _withdrawApplicationValidator   = new Mock <IRoatpWithdrawApplicationViewModelValidator>();

            _controller = new RoatpGatewayApplicationActionsController(ApplyApiClient.Object, _applicationActionsOrchestrator.Object,
                                                                       _removeApplicationValidator.Object, _withdrawApplicationValidator.Object);

            _controller.ControllerContext = MockedControllerContext.Setup();
            UserId   = _controller.ControllerContext.HttpContext.User.UserId();
            Username = _controller.ControllerContext.HttpContext.User.UserDisplayName();
        }
Example #17
0
        public void Setup()
        {
            CoreSetup();

            _orchestrator  = new Mock <IGatewayOverviewOrchestrator>();
            _validator     = new Mock <IRoatpGatewayApplicationViewModelValidator>();
            _pageValidator = new Mock <IRoatpGatewayPageValidator>();

            _controller = new RoatpGatewayController(ApplyApiClient.Object, _orchestrator.Object,
                                                     _validator.Object, Logger.Object, _pageValidator.Object);

            _controller.ControllerContext = MockedControllerContext.Setup();
            UserId   = _controller.ControllerContext.HttpContext.User.UserId();
            Username = _controller.ControllerContext.HttpContext.User.UserDisplayName();
        }
        public void SetUp()
        {
            _assessorApiClient            = new Mock <IRoatpAssessorApiClient>();
            _assessorOutcomeValidator     = new AssessorOutcomeValidator();
            _assessorOverviewOrchestrator = new Mock <IAssessorOverviewOrchestrator>();

            _controller = new AssessorOutcomeController(_assessorApiClient.Object, _assessorOverviewOrchestrator.Object, _assessorOutcomeValidator)
            {
                ControllerContext = MockedControllerContext.Setup()
            };

            _assessorApiClient.Setup(x => x.UpdateAssessorReviewStatus(_applicationId, _controller.User.UserId(), _controller.User.UserDisplayName(), It.IsAny <string>())).ReturnsAsync(true);

            _applicationViewModel = GetApplicationViewModel();
            _assessorOverviewOrchestrator.Setup(x => x.GetOverviewViewModel(It.IsAny <GetAssessorOverviewRequest>())).ReturnsAsync(_applicationViewModel);
        }
        public void SetUp()
        {
            _oversightOrchestrator = new Mock <IOversightOrchestrator>();
            _outcomeOrchestrator   = new Mock <IApplicationOutcomeOrchestrator>();
            _appealOrchestrator    = new Mock <IAppealOrchestrator>();

            _controller = new OversightController(_outcomeOrchestrator.Object,
                                                  _oversightOrchestrator.Object,
                                                  _appealOrchestrator.Object)
            {
                ControllerContext = MockedControllerContext.Setup()
            };

            var tempDataProvider          = Mock.Of <ITempDataProvider>();
            var tempDataDictionaryFactory = new TempDataDictionaryFactory(tempDataProvider);

            _tempDataDictionary  = tempDataDictionaryFactory.GetTempData(new DefaultHttpContext());
            _controller.TempData = _tempDataDictionary;
        }
        public void Before_each_test()
        {
            _roatpOrganisationApiClient = new Mock <IRoatpOrganisationApiClient>();
            _applicationApplyApiClient  = new Mock <IRoatpApplicationApiClient>();
            _clarificationValidator     = new Mock <IRoatpFinancialClarificationViewModelValidator>();
            _qnaApiClient     = new Mock <IQnaApiClient>();
            _csvExportService = new Mock <ICsvExportService>();


            _financialReviewDetails = new FinancialReviewDetails();
            MockHttpContextAccessor = SetupMockedHttpContextAccessor();

            _controller = new RoatpFinancialController(_roatpOrganisationApiClient.Object,
                                                       _applicationApplyApiClient.Object,
                                                       _qnaApiClient.Object,
                                                       MockHttpContextAccessor.Object, _clarificationValidator.Object, _csvExportService.Object)
            {
                ControllerContext = MockedControllerContext.Setup()
            };
        }
Example #21
0
        public void Setup()
        {
            CoreSetup();
            _logger       = new Mock <ILogger <RoatpGatewayPeopleInControlController> >();
            _orchestrator = new Mock <IPeopleInControlOrchestrator>();
            ViewModel     = new PeopleInControlPageViewModel {
                ApplicationId = _applicationId
            };

            Request = new GetPeopleInControlRequest(_applicationId, UserId, Username);
            _orchestrator.Setup(x =>
                                x.GetPeopleInControlViewModel(It.IsAny <GetPeopleInControlRequest>()))
            .ReturnsAsync(ViewModel)
            .Verifiable("view model not returned");

            _controller = new RoatpGatewayPeopleInControlController(ApplyApiClient.Object, _logger.Object, GatewayValidator.Object, _orchestrator.Object);

            _controller.ControllerContext = MockedControllerContext.Setup();
            UserId   = _controller.ControllerContext.HttpContext.User.UserId();
            Username = _controller.ControllerContext.HttpContext.User.UserDisplayName();
        }
        public void when_validation_errors_occur_page_refreshes_with_validation_messages()
        {
            var buttonPressed = "submitClarificationFiles";

            _applicationApplyApiClient.Setup(x => x.GetRoatpSequences()).ReturnsAsync(new List <RoatpSequence>());
            _qnaApiClient.Setup(x => x.GetSectionBySectionNo(_applicationId,
                                                             RoatpQnaConstants.RoatpSequences.YourOrganisation,
                                                             RoatpQnaConstants.RoatpSections.YourOrganisation.OrganisationDetails))
            .ReturnsAsync(new Section {
                ApplicationId = _applicationId, QnAData = new QnAData()
            });
            _qnaApiClient.Setup(x => x.GetSectionBySectionNo(_applicationId,
                                                             RoatpQnaConstants.RoatpSequences.YourOrganisation,
                                                             RoatpQnaConstants.RoatpSections.YourOrganisation.DescribeYourOrganisation))
            .ReturnsAsync(new Section {
                ApplicationId = _applicationId, QnAData = new QnAData()
            });
            _controller = new RoatpFinancialController(_roatpOrganisationApiClient.Object,
                                                       _applicationApplyApiClient.Object,
                                                       _qnaApiClient.Object,
                                                       _searchTermValidator.Object, _clarificationValidator.Object, Mock.Of <ICsvExportService>())
            {
                ControllerContext = MockedControllerContext.Setup(buttonPressed)
            };

            _clarificationValidator.Setup(x =>
                                          x.Validate(It.IsAny <RoatpFinancialClarificationViewModel>(), It.IsAny <bool>(), It.IsAny <bool>()))
            .Returns(new ValidationResponse {
                Errors = new List <ValidationErrorDetail> {
                    new ValidationErrorDetail {
                        ErrorMessage = "error message", Field = "errorField"
                    }
                }
            });

            _applicationApplyApiClient.Setup(x => x.GetApplication(It.IsAny <Guid>())).ReturnsAsync(
                new RoatpApply
            {
                ApplicationId = _applicationId,
                ApplyData     = new RoatpApplyData
                {
                    ApplyDetails = new RoatpApplyDetails
                    {
                        OrganisationName       = "org name",
                        UKPRN                  = "12344321",
                        ReferenceNumber        = "3443",
                        ProviderRouteName      = "main",
                        ApplicationSubmittedOn = DateTime.Today
                    },
                    Sequences = new List <RoatpApplySequence>
                    {
                        new RoatpApplySequence
                        {
                            SequenceNo  = 5,
                            NotRequired = true
                        }
                    }
                }
            });

            _applicationApplyApiClient.Setup(x =>
                                             x.UploadClarificationFile(_applicationId, It.IsAny <string>(), It.IsAny <IFormFileCollection>()))
            .ReturnsAsync(true);


            _financialReviewDetails = new FinancialReviewDetails
            {
                GradedBy                 = MockHttpContextAccessor.Name,
                GradedOn                 = DateTime.UtcNow,
                SelectedGrade            = FinancialApplicationSelectedGrade.Good,
                FinancialDueDate         = DateTime.Today.AddDays(5),
                Comments                 = "comments",
                ClarificationResponse    = "clarification response",
                ClarificationRequestedOn = DateTime.UtcNow
            };

            _applicationApplyApiClient.Setup(x => x.GetFinancialReviewDetails(_applicationId)).ReturnsAsync(_financialReviewDetails);

            var vm = new RoatpFinancialClarificationViewModel
            {
                ApplicationId               = _applicationId,
                FinancialReviewDetails      = _financialReviewDetails,
                OutstandingFinancialDueDate = new FinancialDueDate
                {
                    Day   = "1",
                    Month = "1",
                    Year  = (DateTime.Now.Year + 1).ToString()
                },
                ClarificationResponse = "clarification response",
                ClarificationComments = "clarification comments",
                FilesToUpload         = null
            };
            var result = _controller.SubmitClarification(_applicationId, vm).Result as ViewResult;

            Assert.IsTrue(result.ViewName.Contains("Application_Clarification.cshtml"));
            var resultModel = result.Model as RoatpFinancialClarificationViewModel;

            Assert.AreEqual(1, resultModel.ErrorMessages.Count);
        }
        public void When_clarification_file_is_removed_and_page_is_refreshed_with_filename_removed_from_model()
        {
            var buttonPressed = "removeClarificationFile";

            _applicationApplyApiClient.Setup(x => x.GetRoatpSequences()).ReturnsAsync(new List <RoatpSequence>());
            _qnaApiClient.Setup(x => x.GetSectionBySectionNo(_applicationId,
                                                             RoatpQnaConstants.RoatpSequences.YourOrganisation,
                                                             RoatpQnaConstants.RoatpSections.YourOrganisation.OrganisationDetails))
            .ReturnsAsync(new Section {
                ApplicationId = _applicationId, QnAData = new QnAData()
            });
            _qnaApiClient.Setup(x => x.GetSectionBySectionNo(_applicationId,
                                                             RoatpQnaConstants.RoatpSequences.YourOrganisation,
                                                             RoatpQnaConstants.RoatpSections.YourOrganisation.DescribeYourOrganisation))
            .ReturnsAsync(new Section {
                ApplicationId = _applicationId, QnAData = new QnAData()
            });
            _controller = new RoatpFinancialController(_roatpOrganisationApiClient.Object,
                                                       _applicationApplyApiClient.Object,
                                                       _qnaApiClient.Object,
                                                       MockHttpContextAccessor.Object, _clarificationValidator.Object, Mock.Of <ICsvExportService>())
            {
                ControllerContext = MockedControllerContext.Setup(buttonPressed)
            };

            _clarificationValidator.Setup(x =>
                                          x.Validate(It.IsAny <RoatpFinancialClarificationViewModel>(), It.IsAny <bool>(), It.IsAny <bool>()))
            .Returns(new ValidationResponse {
            });
            var fileToBeRemoved = "file.pdf";

            _financialReviewDetails = new FinancialReviewDetails
            {
                GradedBy                 = MockHttpContextAccessor.Name,
                GradedDateTime           = DateTime.UtcNow,
                SelectedGrade            = FinancialApplicationSelectedGrade.Good,
                FinancialDueDate         = DateTime.Today.AddDays(5),
                Comments                 = "comments",
                ClarificationResponse    = "clarification response",
                ClarificationRequestedOn = DateTime.UtcNow,
                ClarificationFiles       = new List <ClarificationFile> {
                    new ClarificationFile {
                        Filename = fileToBeRemoved
                    }, new ClarificationFile {
                        Filename = "second.pdf"
                    }
                }
            };

            _applicationApplyApiClient.Setup(x => x.GetApplication(It.IsAny <Guid>())).ReturnsAsync(
                new RoatpApply
            {
                ApplicationId = _applicationId,
                ApplyData     = new RoatpApplyData
                {
                    ApplyDetails = new RoatpApplyDetails
                    {
                        OrganisationName       = "org name",
                        UKPRN                  = "12344321",
                        ReferenceNumber        = "3443",
                        ProviderRouteName      = "main",
                        ApplicationSubmittedOn = DateTime.Today
                    },
                    Sequences = new List <RoatpApplySequence>
                    {
                        new RoatpApplySequence
                        {
                            SequenceNo  = 5,
                            NotRequired = true
                        }
                    }
                },
                FinancialGrade = _financialReviewDetails
            });

            _applicationApplyApiClient.Setup(x =>
                                             x.RemoveClarificationFile(_applicationId, It.IsAny <string>(), fileToBeRemoved))
            .ReturnsAsync(true);

            var vm = new RoatpFinancialClarificationViewModel
            {
                ApplicationId               = _applicationId,
                FinancialReviewDetails      = _financialReviewDetails,
                OutstandingFinancialDueDate = new FinancialDueDate
                {
                    Day   = "1",
                    Month = "1",
                    Year  = (DateTime.Now.Year + 1).ToString()
                },
                ClarificationResponse = "clarification response",
                ClarificationComments = "clarification comments",
                FilesToUpload         = null
            };
            var result = _controller.SubmitClarification(_applicationId, vm).Result as ViewResult;

            Assert.IsTrue(result.ViewName.Contains("Application_Clarification.cshtml"));
            var resultModel = result.Model as RoatpFinancialClarificationViewModel;

            Assert.IsTrue(resultModel.FinancialReviewDetails.ClarificationFiles.Count == 1);
            Assert.IsTrue(resultModel.FinancialReviewDetails.ClarificationFiles[0].Filename == "second.pdf");
        }