public async Task TestBlobAttributesEncryptionAsync() { CloudBlobContainer container = GetRandomContainerReference(); try { await container.CreateIfNotExistsAsync(); CloudBlockBlob blob = container.GetBlockBlobReference(BlobTestBase.GetRandomContainerName()); await blob.UploadTextAsync("test"); await blob.FetchAttributesAsync(); Assert.IsTrue(blob.Properties.IsServerEncrypted); CloudBlockBlob testBlob = container.GetBlockBlobReference(blob.Name); await testBlob.DownloadTextAsync(); Assert.IsTrue(testBlob.Properties.IsServerEncrypted); } finally { await container.DeleteAsync(); } }
public async Task CloudBlobClientListBlobsSegmentedWithPrefixAsync() { string name = "bb" + GetRandomContainerName(); DelegatingHandlerImpl delegatingHandlerImpl = new DelegatingHandlerImpl(new DelegatingHandlerImpl()); CloudBlobClient blobClient = GenerateCloudBlobClient(delegatingHandlerImpl); CloudBlobContainer rootContainer = blobClient.GetRootContainerReference(); CloudBlobContainer container = blobClient.GetContainerReference(name); try { await rootContainer.CreateIfNotExistsAsync(); await container.CreateAsync(); List <string> blobNames = await CreateBlobsAsync(container, 3, BlobType.BlockBlob); List <string> rootBlobNames = await CreateBlobsAsync(rootContainer, 2, BlobType.BlockBlob); BlobResultSegment results; BlobContinuationToken token = null; do { results = await blobClient.ListBlobsSegmentedAsync("bb", token); token = results.ContinuationToken; foreach (CloudBlockBlob blob in results.Results) { await blob.DeleteAsync(); rootBlobNames.Remove(blob.Name); } }while (token != null); Assert.AreEqual(0, rootBlobNames.Count); results = await blobClient.ListBlobsSegmentedAsync("bb", token); Assert.AreEqual(0, results.Results.Count()); Assert.IsNull(results.ContinuationToken); results = await blobClient.ListBlobsSegmentedAsync(name, token); Assert.AreEqual(0, results.Results.Count()); Assert.IsNull(results.ContinuationToken); token = null; do { results = await blobClient.ListBlobsSegmentedAsync(name + "/", token); token = results.ContinuationToken; foreach (CloudBlockBlob blob in results.Results) { Assert.IsTrue(blobNames.Remove(blob.Name)); } }while (token != null); Assert.AreEqual(0, blobNames.Count); Assert.AreNotEqual(0, delegatingHandlerImpl.CallCount); } finally { container.DeleteIfExistsAsync().Wait(); } }