Esempio n. 1
0
        protected IntegrationTestBase()
        {
            if (TestContext.Parameters.Count == 0)
            {
                throw new ArgumentException("No setting file is configured for the integration tests.");
            }


            // Build a host using the same config for the real functions app so we can get to the settings and reuse the client for getting key vault secrets.
            // Based on ideas from here: https://saebamini.com/integration-testing-in-azure-functions-with-dependency-injection/
            var startup = new Startup();
            var host    = new HostBuilder()
                          .ConfigureAppConfiguration((a, b) =>
            {
                var assemblyPath = Assembly.GetExecutingAssembly().Location;
                string basePath  = Path.GetDirectoryName(assemblyPath);
                startup.ConfigureAppConfiguration(b, basePath);
            })
                          .ConfigureWebJobs(startup.Configure)
                          .Build();
            var _identityHelper = host.Services.GetRequiredService <AzureIdentityHelper>();

            TenantId        = _identityHelper.TenantId;
            KeyVaultHelpers = host.Services.GetRequiredService <KeyVaultHelpers>();
        }
Esempio n. 2
0
 public DataLakeClientFactory(ILogger <DataLakeClientFactory> logger, KeyVaultHelpers keyVaultHelper, AzureIdentityHelper azureIdentityHelper)
 {
     _logger              = logger;
     _keyVaultHelper      = keyVaultHelper;
     _azureIdentityHelper = azureIdentityHelper;
 }