当前位置: 首页>>代码示例>>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;未经允许,请勿转载。