public async Task TestListBlobsEncryptionAsync()
        {
            bool blobFound = false; 
            CloudBlobContainer container = GetRandomContainerReference();

            try
            {
                    await container.CreateIfNotExistsAsync();

                    CloudBlockBlob blob = container.GetBlockBlobReference(BlobTestBase.GetRandomContainerName());
                    await blob.UploadTextAsync("test");

                BlobResultSegment results = await container.ListBlobsSegmentedAsync(null);
                foreach (IListBlobItem b in results.Results)
                {
                    CloudBlob cloudBlob = (CloudBlob)b;
                    Assert.IsTrue(cloudBlob.Properties.IsServerEncrypted);

                    blobFound = true;
                }

                Assert.IsTrue(blobFound);
            }
            finally
            {
                await container.DeleteAsync();
            }
        }
Exemplo n.º 2
0
        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
            {
                container.DeleteIfExistsAsync().Wait();
            }
        }
        public async Task TestBlobEncryptionAsync()
        {
            bool requestFound = false;

            OperationContext ctxt = new OperationContext();
            CloudBlobContainer container = GetRandomContainerReference(); 

            try
            {
                    await container.CreateIfNotExistsAsync();

                    CloudBlockBlob blob = container.GetBlockBlobReference(BlobTestBase.GetRandomContainerName());
                    await blob.UploadTextAsync("test");

                ctxt.RequestCompleted += (sender, args) =>
                {
                    Assert.IsTrue(args.RequestInformation.IsRequestServerEncrypted);
                    requestFound = true;
                };

                await blob.UploadTextAsync("test", null, null, null, ctxt);
                Assert.IsTrue(requestFound);
            }
            finally
            {
                await container.DeleteAsync();
            }
        }
        public void MyTestInitialize()
        {
            if (TestBase.BlobBufferManager != null)
            {
                TestBase.BlobBufferManager.OutstandingBufferCount = 0;
            }

            this.container = GetRandomContainerReference();
            this.container.CreateIfNotExists();
            this.blob = this.container.GetBlockBlobReference(BlobTestBase.GetRandomContainerName());
            this.blob.UploadText("test");
        }