當前位置: 首頁>>代碼示例>>C#>>正文


C# BlobServiceClient.GetContainerProperties方法代碼示例

本文整理匯總了C#中BlobServiceClient.GetContainerProperties方法的典型用法代碼示例。如果您正苦於以下問題:C# BlobServiceClient.GetContainerProperties方法的具體用法?C# BlobServiceClient.GetContainerProperties怎麽用?C# BlobServiceClient.GetContainerProperties使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在BlobServiceClient的用法示例。


在下文中一共展示了BlobServiceClient.GetContainerProperties方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: GetContainerProperties_BreakingLeaseContainer_ReturnsLeaseDetails

        public void GetContainerProperties_BreakingLeaseContainer_ReturnsLeaseDetails()
        {
            const int leaseLength = 30;
            IBlobServiceClient client = new BlobServiceClient(AccountSettings);
            var containerName = GenerateSampleContainerName();
            CreateContainer(containerName);
            string lease = LeaseContainer(containerName, TimeSpan.FromSeconds(leaseLength), null);
            BreakContainerLease(containerName, lease, leaseLength);
            try
            {

                var response = client.GetContainerProperties(containerName);

                Assert.AreEqual(LeaseStatus.Locked, response.LeaseStatus);
                Assert.AreEqual(LeaseState.Breaking, response.LeaseState);
            }
            finally
            {
                ReleaseContainerLease(containerName, lease);
            }
        }
開發者ID:renlesterdg,項目名稱:BasicAzureStorageSDK,代碼行數:21,代碼來源:BlobServiceClientTests.cs

示例2: GetContainerProperties_InfiniteLeaseContainer_ReturnsLeaseDetails

        public void GetContainerProperties_InfiniteLeaseContainer_ReturnsLeaseDetails()
        {
            IBlobServiceClient client = new BlobServiceClient(AccountSettings);
            var containerName = GenerateSampleContainerName();
            CreateContainer(containerName);
            string lease = LeaseContainer(containerName, null, null);
            try
            {

                var response = client.GetContainerProperties(containerName);

                Assert.AreEqual(LeaseStatus.Locked, response.LeaseStatus);
                Assert.AreEqual(LeaseDuration.Infinite, response.LeaseDuration);
                Assert.AreEqual(LeaseState.Leased, response.LeaseState);
            }
            finally
            {
                ReleaseContainerLease(containerName, lease);
            }
        }
開發者ID:renlesterdg,項目名稱:BasicAzureStorageSDK,代碼行數:20,代碼來源:BlobServiceClientTests.cs

示例3: GetContainerProperties_FixedLeaseContainer_ReturnsLeaseDetails

        public void GetContainerProperties_FixedLeaseContainer_ReturnsLeaseDetails()
        {
            IBlobServiceClient client = new BlobServiceClient(AccountSettings);
            var containerName = GenerateSampleContainerName();
            CreateContainer(containerName);
            LeaseContainer(containerName, TimeSpan.FromSeconds(30), null);

            var response = client.GetContainerProperties(containerName);

            Assert.AreEqual(LeaseStatus.Locked, response.LeaseStatus);
            Assert.AreEqual(LeaseDuration.Fixed, response.LeaseDuration);
            Assert.AreEqual(LeaseState.Leased, response.LeaseState);
        }
開發者ID:renlesterdg,項目名稱:BasicAzureStorageSDK,代碼行數:13,代碼來源:BlobServiceClientTests.cs

示例4: GetContainerProperties_ContainerWithMetadata_ReturnsMetadata

        public void GetContainerProperties_ContainerWithMetadata_ReturnsMetadata()
        {
            IBlobServiceClient client = new BlobServiceClient(AccountSettings);
            var containerName = GenerateSampleContainerName();
            CreateContainer(containerName, new Dictionary<string, string>() {
                { "a", "1" },
                { "b", "2" }
            });

            var response = client.GetContainerProperties(containerName);

            Assert.IsNotNull(response.Metadata);
            Assert.AreEqual(2, response.Metadata.Count);
            Assert.IsTrue(response.Metadata.Any(kvp => kvp.Key == "a" && kvp.Value == "1"));
            Assert.IsTrue(response.Metadata.Any(kvp => kvp.Key == "b" && kvp.Value == "2"));
        }
開發者ID:renlesterdg,項目名稱:BasicAzureStorageSDK,代碼行數:16,代碼來源:BlobServiceClientTests.cs

示例5: GetContainerProperties_NonexistentContainer_ThrowsContainerNotFoundException

        public void GetContainerProperties_NonexistentContainer_ThrowsContainerNotFoundException()
        {
            IBlobServiceClient client = new BlobServiceClient(AccountSettings);
            var containerName = GenerateSampleContainerName();

            client.GetContainerProperties(containerName);

            // expects exception
        }
開發者ID:renlesterdg,項目名稱:BasicAzureStorageSDK,代碼行數:9,代碼來源:BlobServiceClientTests.cs

示例6: GetContainerProperties_ValidContainer_ReturnsProperties

        public void GetContainerProperties_ValidContainer_ReturnsProperties()
        {
            IBlobServiceClient client = new BlobServiceClient(AccountSettings);
            var containerName = GenerateSampleContainerName();
            CreateContainer(containerName);

            var response = client.GetContainerProperties(containerName);

            Assert.IsNotNull(response.Metadata);
            Assert.IsNotNullOrEmpty(response.ETag);
            Assert.AreEqual(LeaseStatus.Unlocked, response.LeaseStatus);
            Assert.AreEqual(LeaseState.Available, response.LeaseState);
        }
開發者ID:renlesterdg,項目名稱:BasicAzureStorageSDK,代碼行數:13,代碼來源:BlobServiceClientTests.cs


注:本文中的BlobServiceClient.GetContainerProperties方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。