public async Task CloudFileShareCreateIfNotExistsAsync() { CloudFileShare share = GetRandomShareReference(); try { Assert.IsTrue(await share.CreateIfNotExistsAsync()); Assert.IsFalse(await share.CreateIfNotExistsAsync()); } finally { share.DeleteIfExistsAsync().Wait(); } }
public void CloudFileShareCreateIfNotExistsTask() { CloudFileShare share = GetRandomShareReference(); try { Assert.IsTrue(share.CreateIfNotExistsAsync().Result); Assert.IsFalse(share.CreateIfNotExistsAsync().Result); } finally { share.DeleteIfExists(); } }
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 TestFileDirectoryEncryptionAsync() { bool requestFound = false; OperationContext ctxt = new OperationContext(); CloudFileShare share = GetRandomShareReference(); try { await share.CreateIfNotExistsAsync(); ctxt.RequestCompleted += (sender, args) => { Assert.IsTrue(args.RequestInformation.IsRequestServerEncrypted); requestFound = true; }; CloudFileDirectory directory = share.GetRootDirectoryReference().GetDirectoryReference("dir"); await directory.CreateAsync(null, ctxt); Assert.IsTrue(requestFound); requestFound = false; await directory.SetMetadataAsync(null, null, ctxt); Assert.IsTrue(requestFound); } finally { share.DeleteIfExistsAsync().Wait(); } }