public async Task TestFileAttributesEncryptionAsync() { CloudFileShare share = GetRandomShareReference(); try { await share.CreateIfNotExistsAsync(); CloudFileDirectory directory = share.GetRootDirectoryReference(); CloudFile file = directory.GetFileReference("file"); await file.UploadTextAsync("test"); await file.FetchAttributesAsync(); Assert.IsTrue(file.Properties.IsServerEncrypted); CloudFile testFile = directory.GetFileReference(file.Name); await testFile.DownloadTextAsync(); Assert.IsTrue(testFile.Properties.IsServerEncrypted); } finally { share.DeleteIfExistsAsync().Wait(); } }
public async Task TestFileEncryptionAsync() { bool requestFound = false; OperationContext ctxt = new OperationContext(); CloudFileShare share = GetRandomShareReference(); try { await share.CreateIfNotExistsAsync(); CloudFileDirectory directory = share.GetRootDirectoryReference(); CloudFile file = directory.GetFileReference("file"); await file.UploadTextAsync("test"); ctxt.RequestCompleted += (sender, args) => { Assert.IsTrue(args.RequestInformation.IsRequestServerEncrypted); requestFound = true; }; await file.UploadTextAsync("test", null, null, ctxt); Assert.IsTrue(requestFound); requestFound = false; await file.SetPropertiesAsync(null, null, ctxt); Assert.IsTrue(requestFound); requestFound = false; await file.SetMetadataAsync(null, null, ctxt); Assert.IsTrue(requestFound); } finally { share.DeleteIfExistsAsync().Wait(); } }