/// <summary>
 /// Initializes a new instance of the <see cref="TenantedAzureTableUserNotificationStoreFactory"/> class.
 /// </summary>
 /// <param name="tableFactory">The cloud table factory.</param>
 /// <param name="serializerSettingsProvider">The serialization settings provider.</param>
 /// <param name="logger">The logger.</param>
 public TenantedAzureTableUserNotificationStoreFactory(
     ITenantCloudTableFactory tableFactory,
     IJsonSerializerSettingsProvider serializerSettingsProvider,
     ILogger <TenantedAzureTableUserNotificationStoreFactory> logger)
 {
     this.logger = logger
                   ?? throw new ArgumentNullException(nameof(logger));
     this.serializerSettingsProvider = serializerSettingsProvider
                                       ?? throw new ArgumentNullException(nameof(serializerSettingsProvider));
     this.tableFactory = tableFactory
                         ?? throw new ArgumentNullException(nameof(tableFactory));
 }
        public static async Task TearDownTenants(FeatureContext featureContext)
        {
            var tenantManager = TransientTenantManager.GetInstance(featureContext);

            await featureContext.RunAndStoreExceptionsAsync(async() =>
            {
                ITenantCloudTableFactory cloudTableFactory = ContainerBindings.GetServiceProvider(featureContext).GetRequiredService <ITenantCloudTableFactory>();
                CloudTable testTable = await cloudTableFactory.GetTableForTenantAsync(tenantManager.PrimaryTransientClient, TenantedAzureTableUserNotificationStoreFactory.TableDefinition).ConfigureAwait(false);
                await testTable.DeleteIfExistsAsync().ConfigureAwait(false);
            }).ConfigureAwait(false);

            await featureContext.RunAndStoreExceptionsAsync(() =>
            {
                return(tenantManager.CleanupAsync());
            }).ConfigureAwait(false);
        }