public void Setup()
        {
            _bookingsApiClient  = new Mock <IBookingsApiClient>();
            _userAccountService = new Mock <IUserAccountService>();
            var testSettings = new TestUserSecrets
            {
                TestUsernameStem = "@hmcts.net1"
            };

            _controller = new AdminWebsite.Controllers.PersonsController(_bookingsApiClient.Object,
                                                                         JavaScriptEncoder.Default, Options.Create(testSettings), _userAccountService.Object);

            _response = new List <PersonResponse>
            {
                new PersonResponse
                {
                    Id              = Guid.NewGuid(),
                    ContactEmail    = "*****@*****.**",
                    FirstName       = "Adam",
                    LastName        = "Mann",
                    TelephoneNumber = "111222333",
                    Title           = "Ms",
                    MiddleNames     = "No",
                    Username        = "******"
                }
            };
        }
 /// <summary>
 /// Instantiates the controller
 /// </summary>
 public PersonsController(IBookingsApiClient bookingsApiClient, JavaScriptEncoder encoder,
                          IOptions <TestUserSecrets> testSettings, IUserAccountService userAccountService)
 {
     _bookingsApiClient  = bookingsApiClient;
     _encoder            = encoder;
     _userAccountService = userAccountService;
     _testSettings       = testSettings.Value;
 }
예제 #3
0
 public JudiciaryAccountsController(IUserAccountService userAccountService, JavaScriptEncoder encoder,
                                    IBookingsApiClient bookingsApiClient, IOptions <TestUserSecrets> testSettings)
 {
     _userAccountService = userAccountService;
     _encoder            = encoder;
     _bookingsApiClient  = bookingsApiClient;
     _testSettings       = testSettings.Value;
 }
 public ConfigSettingsController(
     IOptions <AzureAdConfiguration> azureAdConfiguration,
     IOptions <KinlyConfiguration> kinlyConfiguration,
     IOptions <ApplicationInsightsConfiguration> applicationInsightsConfiguration,
     IOptions <TestUserSecrets> testSettings)
 {
     _azureAdConfiguration             = azureAdConfiguration.Value;
     _kinlyConfiguration               = kinlyConfiguration.Value;
     _applicationInsightsConfiguration = applicationInsightsConfiguration.Value;
     _testUserSecrets = testSettings.Value;
 }
        public void Setup()
        {
            _bookingsApiClient  = new Mock <IBookingsApiClient>();
            _userAccountService = new Mock <IUserAccountService>();
            var testSettings = new TestUserSecrets
            {
                TestUsernameStem = "@hmcts.net"
            };

            _controller = new AdminWebsite.Controllers.PersonsController(_bookingsApiClient.Object,
                                                                         JavaScriptEncoder.Default, Options.Create(testSettings), _userAccountService.Object);
        }
예제 #6
0
        public void Should_return_response_with_settings()
        {
            var azureAdConfiguration = new AzureAdConfiguration
            {
                ClientId              = "ClientId",
                TenantId              = "TenantId",
                ClientSecret          = "ClientSecret",
                Authority             = "Authority",
                RedirectUri           = "https://vh-admin-web.com",
                PostLogoutRedirectUri = "https://vh-admin-web.com/"
            };

            var testSettings = new TestUserSecrets
            {
                TestUsernameStem = "@hmcts.net"
            };

            var kinlyConfiguration = new KinlyConfiguration {
                ConferencePhoneNumber = "1111111", JoinByPhoneFromDate = "2021-02-03"
            };
            var applicationInsightsConfiguration = new ApplicationInsightsConfiguration();

            var httpContext = new DefaultHttpContext();

            httpContext.Request.Scheme   = "https";
            httpContext.Request.Host     = new HostString("vh-admin-web.com");
            httpContext.Request.PathBase = "";

            var controllerContext = new ControllerContext {
                HttpContext = httpContext
            };

            var configSettingsController = new ConfigSettingsController(
                Options.Create(azureAdConfiguration),
                Options.Create(kinlyConfiguration),
                Options.Create(applicationInsightsConfiguration),
                Options.Create(testSettings))
            {
                ControllerContext = controllerContext
            };

            var actionResult   = (OkObjectResult)configSettingsController.Get().Result;
            var clientSettings = (ClientSettingsResponse)actionResult.Value;

            clientSettings.ClientId.Should().Be(azureAdConfiguration.ClientId);
            clientSettings.TenantId.Should().Be(azureAdConfiguration.TenantId);
            clientSettings.RedirectUri.Should().Be(azureAdConfiguration.RedirectUri);
            clientSettings.PostLogoutRedirectUri.Should().Be(azureAdConfiguration.PostLogoutRedirectUri);
            clientSettings.ConferencePhoneNumber.Should().Be(kinlyConfiguration.ConferencePhoneNumber);
            clientSettings.JoinByPhoneFromDate.Should().Be(kinlyConfiguration.JoinByPhoneFromDate);
            clientSettings.TestUsernameStem.Should().Be(testSettings.TestUsernameStem);
        }