public void Arrange()
        {
            var certificatePrivateProviderUkprnController =
                new CertificatePrivateProviderUkprnController(MockLogger.Object,
                                                              MockHttpContextAccessor.Object,
                                                              MockCertificateApiClient,
                                                              MockSession.Object
                                                              );

            var roatpApiClient = new Mock <IRoatpApiClient>();

            SetupSession();

            var mockStringLocaliserBuildernew = new MockStringLocaliserBuilder();

            var localiser = mockStringLocaliserBuildernew
                            .WithKey(ResourceMessageName.NoAssesmentProviderFound)
                            .WithKeyValue("100000000")
                            .Build <CertificateUkprnViewModelValidator>();

            var certificateUkprnViewModelValidator
                = new CertificateUkprnViewModelValidator(localiser.Object,
                                                         roatpApiClient.Object);

            var vm = new CertificateUkprnViewModel
            {
                Id                = Certificate.Id,
                Ukprn             = "AAAAAA",
                IsPrivatelyFunded = true
            };

            _validationResult = certificateUkprnViewModelValidator.Validate(vm);
        }
        private void SetupOrchestratorMocks()
        {
            ContactQueryRepositoryMock = new Mock <IContactQueryRepository>();

            _mockStringLocaliserBuilder = new MockStringLocaliserBuilder();

            var ukPrnStringLocalizer = _mockStringLocaliserBuilder
                                       .WithKey(ResourceMessageName.InvalidUkprn)
                                       .WithKeyValue("100000000")
                                       .Build <UkPrnValidator>();

            UkPrnValidator = new UkPrnValidator(ukPrnStringLocalizer.Object);

            //GetContactsOrchestratorLocaliserMock = _mockStringLocaliserBuilder
            //    .WithKey(ResourceMessageName.NoAssesmentProviderFound)
            //    .WithKeyValue("100000000")
            //    .Build<GetContactsOrchestrator>();

            //OrchestratorLoggerMock = new Mock<ILogger<GetContactsOrchestrator>>();

            //_getContactsOrchestrator = new GetContactsOrchestrator(
            //    ContactQueryRepositoryMock.Object,
            //    OrchestratorLoggerMock.Object);

            OrganisationQueryRepositoryMock = new Mock <IOrganisationQueryRepository>();
            SearchOrganisationForContactsValidatorLocaliserMock = new Mock <IStringLocalizer <SearchOrganisationForContactsValidator> >();

            _searchOrganisationForContactsValidator = new SearchOrganisationForContactsValidator(
                OrganisationQueryRepositoryMock.Object,
                SearchOrganisationForContactsValidatorLocaliserMock.Object
                );
        }
        public void Arrange()
        {
            MockStringLocaliserBuilder mockStringLocaliserBuilder;

            mockStringLocaliserBuilder = new MockStringLocaliserBuilder();

            Mock <IStringLocalizer <CertificateLearnerStartDateViewModelValidator> >
            mockLocaliser = new Mock <IStringLocalizer <CertificateLearnerStartDateViewModelValidator> >();

            mockLocaliser = mockStringLocaliserBuilder
                            .WithKey("XXXX")
                            .WithKeyValue("100000000")
                            .Build <CertificateLearnerStartDateViewModelValidator>();

            var certificateLearnerStartDateViewModelValidator =
                new CertificateLearnerStartDateViewModelValidator(mockLocaliser.Object);

            var certificatePrivateLearnerStartDateController =
                new CertificatePrivateLearnerStartDateController(MockLogger.Object,
                                                                 MockHttpContextAccessor.Object,
                                                                 MockCertificateApiClient,
                                                                 certificateLearnerStartDateViewModelValidator,
                                                                 MockSession.Object
                                                                 );

            SetupSession();

            _result = certificatePrivateLearnerStartDateController.LearnerStartDate(false).GetAwaiter().GetResult();

            var result = _result as ViewResult;

            _viewModelResponse = result.Model as CertificateLearnerStartDateViewModel;
        }
        private void SetupControllerMocks()
        {
            ContactControllerLocaliserMock = _mockStringLocaliserBuilder
                                             .WithKey(ResourceMessageName.NoAssesmentProviderFound)
                                             .WithKeyValue("100000000")
                                             .Build <ContactQueryController>();

            ControllerLoggerMock = new Mock <ILogger <ContactQueryController> >();
        }
Beispiel #5
0
        public void Setup()
        {
            _mockStringLocaliserBuilder = new MockStringLocaliserBuilder();

            createOrganisationRequestModelValidatorStringLocaliser = _mockStringLocaliserBuilder
                                                                     .WithKey(ResourceMessageName.NoAssesmentProviderFound)
                                                                     .WithKeyValue("100000000")
                                                                     .Build <CreateOrganisationRequestValidator>();

            ContactQueryRepositoryMock      = new Mock <IContactQueryRepository>();
            OrganisationQueryRepositoryMock = new Mock <IOrganisationQueryRepository>();

            CreateOrganisationRequestValidator = new CreateOrganisationRequestValidator(createOrganisationRequestModelValidatorStringLocaliser.Object,
                                                                                        ContactQueryRepositoryMock.Object, OrganisationQueryRepositoryMock.Object);
        }
        public static void Setup()
        {
            var mockStringLocaliserBuilder = new MockStringLocaliserBuilder();

            var stringLocalizerMock = mockStringLocaliserBuilder
                                      .WithKey(ResourceMessageName.NoAssesmentProviderFound)
                                      .WithKeyValue("100000000")
                                      .Build <UpdateContactRequestValidator>();

            ContactQueryRepositoryMock      = new Mock <IContactQueryRepository>();
            OrganisationQueryRepositoryMock = new Mock <IOrganisationQueryRepository>();

            UpdateContactRequestValidator = new UpdateContactRequestValidator(stringLocalizerMock.Object,
                                                                              ContactQueryRepositoryMock.Object);
        }
Beispiel #7
0
        private void SetupControllerMocks()
        {
            _mockStringLocaliserBuilder = new MockStringLocaliserBuilder();

            OrganisationControllerLocaliserMock = _mockStringLocaliserBuilder
                                                  .WithKey(ResourceMessageName.NoAssesmentProviderFound)
                                                  .WithKeyValue("100000000")
                                                  .Build <OrganisationQueryController>();

            OrganisationQueryRepositoryMock = new Mock <IOrganisationQueryRepository>();

            _mockStringLocaliserBuilder = new MockStringLocaliserBuilder();

            var ukPrnStringLocalizer = _mockStringLocaliserBuilder
                                       .WithKey(ResourceMessageName.InvalidUkprn)
                                       .WithKeyValue("100000000")
                                       .Build <UkPrnValidator>();

            UkPrnValidator = new UkPrnValidator(ukPrnStringLocalizer.Object);

            ControllerLoggerMock = new Mock <ILogger <OrganisationQueryController> >();
        }
Beispiel #8
0
        public void Arrange()
        {
            var mockStringLocaliserBuildernew = new MockStringLocaliserBuilder();

            var localiser = mockStringLocaliserBuildernew
                            .WithKey(ResourceMessageName.NoAssesmentProviderFound)
                            .WithKeyValue("100000000")
                            .Build <CertificateLearnerStartDateViewModelValidator>();

            CertificateLearnerStartDateViewModelValidator validator =
                new CertificateLearnerStartDateViewModelValidator(localiser.Object);

            var certificatePrivateLearnerStartDateController =
                new CertificatePrivateLearnerStartDateController(MockLogger.Object,
                                                                 MockHttpContextAccessor.Object,
                                                                 MockCertificateApiClient,
                                                                 validator,
                                                                 MockSession.Object
                                                                 );

            var vm = new CertificateLearnerStartDateViewModel
            {
                Id                = Certificate.Id,
                FullName          = "James Corley",
                Day               = "12",
                Month             = "12",
                Year              = "2017",
                IsPrivatelyFunded = true
            };

            SetupSession();
            AddRedirectCheck();

            var result = certificatePrivateLearnerStartDateController.LearnerStartDate(vm).GetAwaiter().GetResult();

            _result = result as RedirectToActionResult;
        }
Beispiel #9
0
        public void Arrange()
        {
            var certificatePrivateFirstNameController =
                new CertificatePrivateFirstNameController(MockLogger.Object,
                                                          MockHttpContextAccessor.Object,
                                                          MockCertificateApiClient,
                                                          MockSession.Object
                                                          );

            SetupSession();

            var mockStringLocaliserBuildernew = new MockStringLocaliserBuilder();

            var localiser = mockStringLocaliserBuildernew
                            .WithKey(ResourceMessageName.NoAssesmentProviderFound)
                            .WithKeyValue("100000000")
                            .Build <CertificateFirstNameViewModelValidator>();

            var certificateFirstNameViewModelValidator
                = new CertificateFirstNameViewModelValidator(localiser.Object);


            var vm = new CertificateFirstNameViewModel
            {
                Id                = Certificate.Id,
                FullName          = "James Corley",
                FirstName         = String.Empty,
                FamilyName        = "",
                GivenNames        = "James",
                Level             = 2,
                Standard          = "91",
                IsPrivatelyFunded = true
            };

            _validationResult = certificateFirstNameViewModelValidator.Validate(vm);
        }