private static void CleanupContainers() { IBlobService blobService = new BlobService(StorageAccount.Name, StorageAccount.Key); BlobContainer[] blobContainers = blobService.ListContainers(); bool failure = false; foreach (BlobContainer blobContainer in blobContainers) { if (blobContainer.Name.StartsWith("test", StringComparison.OrdinalIgnoreCase)) { bool deleteSuccess = blobService.DeleteContainer(blobContainer.Name); if (!deleteSuccess) { Console.WriteLine("Failed to delete container named '{0}'.", blobContainer.Name); failure = true; } } } Assert.IsFalse(failure, "The clean-up failed to delete at least one container, see console output for more information."); }
public void IntegrationTestListContainersWithRetries() { IBlobService blobService = new BlobService(StorageAccount.Name, StorageAccount.Key); BlobContainer[] blobContainers = blobService.ListContainers(2); Assert.IsTrue(blobContainers.Length > 0, "The blob container list was empty when it was not expected to be so."); foreach (BlobContainer blobContainer in blobContainers) { Console.WriteLine("Found container name - " + blobContainer.Name); } }