public async Task GetAllBlobContainers() { //create two blob containers string containerName1 = Recording.GenerateAssetName("testblob1"); string containerName2 = Recording.GenerateAssetName("testblob2"); BlobContainer container1 = (await _blobContainerContainer.CreateOrUpdateAsync(containerName1, new BlobContainerData())).Value; BlobContainer container2 = (await _blobContainerContainer.CreateOrUpdateAsync(containerName2, new BlobContainerData())).Value; //validate if there are two containers BlobContainer container3 = null; BlobContainer container4 = null; int count = 0; await foreach (BlobContainer container in _blobContainerContainer.GetAllAsync()) { count++; if (container.Id.Name == containerName1) { container3 = container; } if (container.Id.Name == containerName2) { container4 = container; } } Assert.AreEqual(count, 2); Assert.IsNotNull(container3); Assert.IsNotNull(container4); }
public async Task List() { #region Snippet:Managing_BlobContainers_ListBlobContainers BlobContainerContainer blobContainerContainer = blobService.GetBlobContainers(); AsyncPageable <BlobContainer> response = blobContainerContainer.GetAllAsync(); await foreach (BlobContainer blobContainer in response) { Console.WriteLine(blobContainer.Id.Name); } #endregion }