public async Task CloudFileClientWithUppercaseAccountNameAsync()
 {
     StorageCredentials credentials = new StorageCredentials(TestBase.StorageCredentials.AccountName.ToUpper(), Convert.ToBase64String(TestBase.StorageCredentials.ExportKey()));
     Uri             baseAddressUri = new Uri(TestBase.TargetTenantConfig.FileServiceEndpoint);
     CloudFileClient fileClient     = new CloudFileClient(baseAddressUri, TestBase.StorageCredentials);
     CloudFileShare  share          = fileClient.GetShareReference("share");
     await share.ExistsAsync();
 }
Example #2
0
        public async Task CloudFileShareExistsAsync()
        {
            CloudFileShare share  = GetRandomShareReference();
            CloudFileShare share2 = share.ServiceClient.GetShareReference(share.Name);

            try
            {
                Assert.IsFalse(await share2.ExistsAsync());

                await share.CreateAsync();

                Assert.IsTrue(await share2.ExistsAsync());
                Assert.IsNotNull(share2.Properties.ETag);
            }
            finally
            {
                share.DeleteIfExistsAsync().Wait();
            }

            Assert.IsFalse(await share2.ExistsAsync());
        }
        public async Task CloudFileClientCreateShareSharedKeyLiteAsync()
        {
            CloudFileClient fileClient = GenerateCloudFileClient();

            fileClient.AuthenticationScheme = AuthenticationScheme.SharedKeyLite;

            string         shareName = GetRandomShareName();
            CloudFileShare share     = fileClient.GetShareReference(shareName);
            await share.CreateAsync();

            bool exists = await share.ExistsAsync();

            Assert.IsTrue(exists);

            await share.DeleteAsync();
        }
        public async Task CloudFileClientServerTimeoutAsync()
        {
            CloudFileClient client = GenerateCloudFileClient();
            CloudFileShare  share  = client.GetShareReference("timeouttest");

            string           timeout = null;
            OperationContext context = new OperationContext();

            context.SendingRequest += (sender, e) =>
            {
                IDictionary <string, string> query = HttpWebUtility.ParseQueryString(e.RequestUri.Query);
                if (!query.TryGetValue("timeout", out timeout))
                {
                    timeout = null;
                }
            };

            FileRequestOptions options = new FileRequestOptions();
            await share.ExistsAsync(null, context);

            Assert.IsNull(timeout);
            await share.ExistsAsync(options, context);

            Assert.IsNull(timeout);

            options.ServerTimeout = TimeSpan.FromSeconds(100);
            await share.ExistsAsync(options, context);

            Assert.AreEqual("100", timeout);

            client.DefaultRequestOptions.ServerTimeout = TimeSpan.FromSeconds(90);
            await share.ExistsAsync(null, context);

            Assert.AreEqual("90", timeout);
            await share.ExistsAsync(options, context);

            Assert.AreEqual("100", timeout);

            options.ServerTimeout = null;
            await share.ExistsAsync(options, context);

            Assert.AreEqual("90", timeout);

            options.ServerTimeout = TimeSpan.Zero;
            await share.ExistsAsync(options, context);

            Assert.IsNull(timeout);
        }