public void Initialize() { this.testContainerName = "unittests" + Guid.NewGuid().ToString(); var account = CloudStorageAccount.DevelopmentStorageAccount; var blobClient = account.CreateCloudBlobClient(); this.Provider = this.provider = new AzureBlobStorage(account, this.testContainerName); this.provider.CreateContainerIfNotExistAsync().GetAwaiter().GetResult(); this.container = blobClient.GetContainerReference(this.testContainerName); }
internal static async Task OneTimeInitializeAsync(CloudStorageAccount azureAccount) { var blobStorage = new AzureBlobStorage(azureAccount, BlobController.DefaultContainerName); await blobStorage.CreateContainerIfNotExistAsync(); Task.Run(async delegate { while (true) { await blobStorage.PurgeBlobsExpiringBeforeAsync(); await Task.Delay(AzureStorageConfig.PurgeExpiredBlobsInterval); } }); }
/// <summary> /// Ensures that the Azure blob container and table are created in the Azure account. /// </summary> /// <param name="azureAccount">The Azure account in use.</param> /// <param name="blobStorage">The blob storage </param> /// <returns>A task representing the asynchronous operation.</returns> private static async Task InitializeLocalCloudAsync(CloudStorageAccount azureAccount, AzureBlobStorage blobStorage) { var tableStorage = azureAccount.CreateCloudTableClient(); await Task.WhenAll( tableStorage.GetTableReference(AzureTableStorageName).CreateIfNotExistsAsync(), blobStorage.CreateContainerIfNotExistAsync()); }