コード例 #1
0
        private IOptions <AzureAdConfiguration> RegisterAzureSecrets(IntTestContext context)
        {
            var azureOptions = Options.Create(_configRoot.GetSection("AzureAd").Get <AzureAdConfiguration>());

            context.Config.AzureAdConfiguration = azureOptions.Value;
            ConfigurationManager.VerifyConfigValuesSet(context.Config.AzureAdConfiguration);
            return(azureOptions);
        }
コード例 #2
0
        private NotifyConfiguration RegisterNotifySecrets(IntTestContext context)
        {
            var notifyOptions = Options.Create(_configRoot.GetSection("NotifyConfiguration").Get <NotifyConfiguration>()).Value;

            context.Config.NotifyConfiguration = notifyOptions;
            ConfigurationManager.VerifyConfigValuesSet(context.Config.NotifyConfiguration);
            return(notifyOptions);
        }
コード例 #3
0
        protected void InitCreateNotificationRequest(AddNotificationRequest request, IntTestContext intTestContext)
        {
            intTestContext.Uri        = ApiUriFactory.NotificationEndpoints.CreateNewEmailNotification;
            intTestContext.HttpMethod = HttpMethod.Post;
            var body = RequestHelper.Serialise(request);

            intTestContext.HttpContent = new StringContent(body, Encoding.UTF8, "application/json");
        }
コード例 #4
0
        private static void RegisterServer(IntTestContext context)
        {
            var webHostBuilder = WebHost.CreateDefaultBuilder()
                                 .UseKestrel(c => c.AddServerHeader = false)
                                 .UseEnvironment("Development")
                                 .UseStartup <Startup>();

            context.Server = new TestServer(webHostBuilder);
        }
コード例 #5
0
        private void RegisterDatabaseSettings(IntTestContext context)
        {
            context.Config.DbConnection = Options.Create(_configRoot.GetSection("ConnectionStrings").Get <ConnectionStringsConfig>()).Value;
            ConfigurationManager.VerifyConfigValuesSet(context.Config.DbConnection);
            var dbContextOptionsBuilder = new DbContextOptionsBuilder <NotificationsApiDbContext>();

            dbContextOptionsBuilder.EnableSensitiveDataLogging();
            dbContextOptionsBuilder.UseSqlServer(context.Config.DbConnection.VhNotificationsApi);
            context.NotifyBookingsDbContextOptions = dbContextOptionsBuilder.Options;
            context.TestDataManager = new TestDataManager(context.NotifyBookingsDbContextOptions);
        }
コード例 #6
0
        public void RegisterSecrets(IntTestContext context)
        {
            var azureOptions  = RegisterAzureSecrets(context);
            var notifyOptions = RegisterNotifySecrets(context);

            RegisterDefaultData();
            RegisterHearingServices(context);
            RegisterDatabaseSettings(context);
            RegisterServer(context);
            RegisterApiSettings(context);
            GenerateBearerTokens(context, azureOptions, notifyOptions);
        }
コード例 #7
0
        private static void GenerateBearerTokens(IntTestContext context, IOptions <AzureAdConfiguration> azureOptions,
                                                 NotifyConfiguration notifyConfiguration)
        {
            context.Tokens.NotificationApiBearerToken = new AzureTokenProvider(azureOptions).GetClientAccessToken(
                azureOptions.Value.ClientId, azureOptions.Value.ClientSecret,
                context.Config.ServicesConfig.VhNotificationApiResourceId);
            context.Tokens.NotificationApiBearerToken.Should().NotBeNullOrEmpty();

            context.Tokens.NotificationCallbackBearerToken =
                new CustomJwtTokenProvider().GenerateTokenForCallbackEndpoint(notifyConfiguration.CallbackSecret, 60);
            context.Tokens.NotificationCallbackBearerToken.Should().NotBeNullOrWhiteSpace();

            Zap.SetAuthToken(context.Tokens.NotificationApiBearerToken);
        }
コード例 #8
0
 public static void RemoveServer(IntTestContext context)
 {
     context.Server.Dispose();
 }
コード例 #9
0
 private static void RegisterApiSettings(IntTestContext context)
 {
     context.Response = new HttpResponseMessage();
 }
コード例 #10
0
 private void RegisterHearingServices(IntTestContext context)
 {
     context.Config.ServicesConfig = Options.Create(_configRoot.GetSection("Services").Get <ServicesConfiguration>()).Value;
     ConfigurationManager.VerifyConfigValuesSet(context.Config.ServicesConfig);
 }
 public CreateNotificationsSteps(IntTestContext context)
 {
     _context = context;
 }
コード例 #12
0
 protected async Task <HttpResponseMessage> SendDeleteRequestAsync(IntTestContext intTestContext)
 {
     using var client = intTestContext.CreateClient();
     return(await client.DeleteAsync(intTestContext.Uri));
 }
コード例 #13
0
 protected async Task <HttpResponseMessage> SendPutRequestAsync(IntTestContext intTestContext)
 {
     using var client = intTestContext.CreateClient();
     return(await client.PutAsync(intTestContext.Uri, intTestContext.HttpContent));
 }
コード例 #14
0
 public static void RemoveNotificationTestData(IntTestContext context)
 {
     // Intentionally left empty
 }
コード例 #15
0
 public HearingReminderSteps(IntTestContext context)
 {
     _context = context;
 }
コード例 #16
0
 public CallbackSteps(IntTestContext context)
 {
     _context = context;
 }
コード例 #17
0
 public GetTemplateSteps(IntTestContext context)
 {
     _context = context;
 }
コード例 #18
0
 public CommonSteps(IntTestContext context)
 {
     _context = context;
 }
コード例 #19
0
 public HearingAmendmentSteps(IntTestContext context)
 {
     _context = context;
 }
コード例 #20
0
 public ConfigHooks(IntTestContext context)
 {
     _configRoot    = ConfigurationManager.BuildConfig("4E35D845-27E7-4A19-BE78-CDA896BF907D");
     context.Config = new Config();
     context.Tokens = new NotificationApiTokens();
 }
コード例 #21
0
 public HearingConfirmationSteps(IntTestContext context)
 {
     _context = context;
 }
コード例 #22
0
 public static async Task RemoveDataCreatedDuringTest(IntTestContext context)
 {
     await context.TestDataManager.RemoveNotifications(context.TestRun.NotificationsCreated.Select(x => x.Id));
 }