public async Task CreateDeleteBlobContainer() { //create blob container string containerName = Recording.GenerateAssetName("testblob"); BlobContainer container1 = (await _blobContainerContainer.CreateOrUpdateAsync(containerName, new BlobContainerData())).Value; Assert.IsNotNull(container1); Assert.AreEqual(container1.Id.Name, containerName); //validate if created successfully BlobContainer container2 = await _blobContainerContainer.GetAsync(containerName); AssertBlobContainerEqual(container1, container2); Assert.IsTrue(await _blobContainerContainer.CheckIfExistsAsync(containerName)); Assert.IsFalse(await _blobContainerContainer.CheckIfExistsAsync(containerName + "1")); BlobContainerData containerData = container1.Data; Assert.IsEmpty(containerData.Metadata); Assert.IsFalse(containerData.HasLegalHold); Assert.IsNull(containerData.PublicAccess); Assert.False(containerData.HasImmutabilityPolicy); //delete blob container BlobContainerDeleteOperation blobContainerDeleteOperation = await container1.DeleteAsync(); await blobContainerDeleteOperation.WaitForCompletionResponseAsync(); //validate if deleted successfully BlobContainer blobContainer3 = await _blobContainerContainer.GetIfExistsAsync(containerName); Assert.IsNull(blobContainer3); Assert.IsFalse(await _blobContainerContainer.CheckIfExistsAsync(containerName)); }
public async Task Get() { #region Snippet:Managing_BlobContainers_GetBlobContainer BlobContainerContainer blobContainerContainer = blobService.GetBlobContainers(); BlobContainer blobContainer = await blobContainerContainer.GetAsync("myBlobContainer"); Console.WriteLine(blobContainer.Id.Name); #endregion }
public async Task Delete() { #region Snippet:Managing_BlobContainers_DeleteBlobContainer BlobContainerContainer blobContainerContainer = blobService.GetBlobContainers(); BlobContainer blobContainer = await blobContainerContainer.GetAsync("myBlobContainer"); await blobContainer.DeleteAsync(); #endregion }