当前位置: 首页>>代码示例>>C#>>正文


C# BlobServiceClient.GetBlobPropertiesAsync方法代码示例

本文整理汇总了C#中BlobServiceClient.GetBlobPropertiesAsync方法的典型用法代码示例。如果您正苦于以下问题:C# BlobServiceClient.GetBlobPropertiesAsync方法的具体用法?C# BlobServiceClient.GetBlobPropertiesAsync怎么用?C# BlobServiceClient.GetBlobPropertiesAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BlobServiceClient的用法示例。


在下文中一共展示了BlobServiceClient.GetBlobPropertiesAsync方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetBlobPropertiesAsync_ExistingBlob_GetsCorrectContentLength

        public async void GetBlobPropertiesAsync_ExistingBlob_GetsCorrectContentLength()
        {
            const string blobContents = "foo";
            var expectedContentLength = Encoding.UTF8.GetByteCount(blobContents);
            var containerName = _util.GenerateSampleContainerName(_runId);
            var blobName = _util.GenerateSampleBlobName(_runId);
            _util.CreateContainer(containerName);
            _util.CreateBlockBlob(containerName, blobName, content: blobContents);
            IBlobServiceClient client = new BlobServiceClient(AccountSettings);

            var properties = await client.GetBlobPropertiesAsync(containerName, blobName);

            Assert.AreEqual(expectedContentLength, properties.ContentLength);
        }
开发者ID:BrianMcBrayer,项目名称:BasicAzureStorageSDK,代码行数:14,代码来源:BlobOperationsTests.cs

示例2: GetBlobPropertiesAsync_ExistingBlob_GetsCorrectContentType

        public async void GetBlobPropertiesAsync_ExistingBlob_GetsCorrectContentType()
        {
            const string expectedContentType = "pigeon/feathers";
            var containerName = _util.GenerateSampleContainerName(_runId);
            var blobName = _util.GenerateSampleBlobName(_runId);
            _util.CreateContainer(containerName);
            _util.CreateBlockBlob(containerName, blobName, contentType: expectedContentType);
            IBlobServiceClient client = new BlobServiceClient(AccountSettings);

            var properties = await client.GetBlobPropertiesAsync(containerName, blobName);

            Assert.AreEqual(expectedContentType, properties.ContentType);
        }
开发者ID:BrianMcBrayer,项目名称:BasicAzureStorageSDK,代码行数:13,代码来源:BlobOperationsTests.cs

示例3: GetBlobPropertiesAsync_LeasedBlobLeaseBroken_GetsLeaseStateBroken

        public async void GetBlobPropertiesAsync_LeasedBlobLeaseBroken_GetsLeaseStateBroken()
        {
            var containerName = _util.GenerateSampleContainerName(_runId);
            var blobName = _util.GenerateSampleBlobName(_runId);
            _util.CreateContainer(containerName);
            _util.CreateBlockBlob(containerName, blobName);
            var lease = _util.LeaseBlob(containerName, blobName, TimeSpan.FromSeconds(15));
            _util.BreakBlobLease(containerName, blobName, lease);
            IBlobServiceClient client = new BlobServiceClient(AccountSettings);
            Thread.Sleep(TimeSpan.FromSeconds(2));

            var properties = await client.GetBlobPropertiesAsync(containerName, blobName);

            Assert.AreEqual(LeaseState.Broken, properties.LeaseState);
        }
开发者ID:BrianMcBrayer,项目名称:BasicAzureStorageSDK,代码行数:15,代码来源:BlobOperationsTests.cs

示例4: GetBlobPropertiesAsync_LeasedBlob_GetsLeaseStatusLocked

        public async void GetBlobPropertiesAsync_LeasedBlob_GetsLeaseStatusLocked()
        {
            var containerName = _util.GenerateSampleContainerName(_runId);
            var blobName = _util.GenerateSampleBlobName(_runId);
            _util.CreateContainer(containerName);
            _util.CreateBlockBlob(containerName, blobName);
            var lease = _util.LeaseBlob(containerName, blobName);
            IBlobServiceClient client = new BlobServiceClient(AccountSettings);

            var properties = await client.GetBlobPropertiesAsync(containerName, blobName);

            Assert.AreEqual(LeaseStatus.Locked, properties.LeaseStatus);
        }
开发者ID:BrianMcBrayer,项目名称:BasicAzureStorageSDK,代码行数:13,代码来源:BlobOperationsTests.cs

示例5: GetBlobPropertiesAsync_ExistingBlobWithSpecifiedContentLanguage_GetsCorrectContentLanguage

        public async void GetBlobPropertiesAsync_ExistingBlobWithSpecifiedContentLanguage_GetsCorrectContentLanguage()
        {
            const string expectedLanguage = "dour";
            var containerName = _util.GenerateSampleContainerName(_runId);
            var blobName = _util.GenerateSampleBlobName(_runId);
            _util.CreateContainer(containerName);
            _util.CreateBlockBlob(containerName, blobName, contentLanguage: expectedLanguage);
            IBlobServiceClient client = new BlobServiceClient(AccountSettings);

            var properties = await client.GetBlobPropertiesAsync(containerName, blobName);

            Assert.AreEqual(expectedLanguage, properties.ContentLanguage);
        }
开发者ID:BrianMcBrayer,项目名称:BasicAzureStorageSDK,代码行数:13,代码来源:BlobOperationsTests.cs

示例6: GetBlobPropertiesAsync_EmptyBlobName_ThrowsArgumentNullException

        public async void GetBlobPropertiesAsync_EmptyBlobName_ThrowsArgumentNullException()
        {
            var containerName = GenerateSampleContainerName();
            var blobName = string.Empty;
            IBlobServiceClient client = new BlobServiceClient(AccountSettings);

            var properties = await client.GetBlobPropertiesAsync(containerName, blobName);

            // exception thrown
        }
开发者ID:renlesterdg,项目名称:BasicAzureStorageSDK,代码行数:10,代码来源:BlobServiceClientTests.cs

示例7: GetBlobPropertiesAsync_ExistingBlobWithMetadata_GetsCorrectMetadata

        public async void GetBlobPropertiesAsync_ExistingBlobWithMetadata_GetsCorrectMetadata()
        {
            var metadata = new Dictionary<string, string>{
                { "HeyHey", "We're the" },
                { "GroundControl", "CallingMajor" }
            };
            var containerName = _util.GenerateSampleContainerName(_runId);
            var blobName = _util.GenerateSampleBlobName(_runId);
            _util.CreateContainer(containerName);
            _util.CreateBlockBlob(containerName, blobName, metadata);
            IBlobServiceClient client = new BlobServiceClient(AccountSettings);

            var properties = await client.GetBlobPropertiesAsync(containerName, blobName);

            Assert.AreEqual(metadata, properties.Metadata);
        }
开发者ID:BrianMcBrayer,项目名称:BasicAzureStorageSDK,代码行数:16,代码来源:BlobOperationsTests.cs

示例8: GetBlobPropertiesAsync_ExistingBlobWithSpecifiedContentMD5_GetsCorrectContentMD5

        public async void GetBlobPropertiesAsync_ExistingBlobWithSpecifiedContentMD5_GetsCorrectContentMD5()
        {
            var containerName = _util.GenerateSampleContainerName(_runId);
            var blobName = _util.GenerateSampleBlobName(_runId);
            _util.CreateContainer(containerName);
            var blobMD5 = _util.CreateBlockBlob(containerName, blobName)
                .Properties.ContentMD5;
            IBlobServiceClient client = new BlobServiceClient(AccountSettings);

            var properties = await client.GetBlobPropertiesAsync(containerName, blobName);

            Assert.AreEqual(blobMD5, properties.ContentMD5);
        }
开发者ID:BrianMcBrayer,项目名称:BasicAzureStorageSDK,代码行数:13,代码来源:BlobOperationsTests.cs

示例9: GetBlobPropertiesAsync_LeasedBlobLeaseBreaking_GetsLeaseStateBreaking

        public async void GetBlobPropertiesAsync_LeasedBlobLeaseBreaking_GetsLeaseStateBreaking()
        {
            var containerName = GenerateSampleContainerName();
            var blobName = GenerateSampleBlobName();
            CreateContainer(containerName);
            CreateBlockBlob(containerName, blobName);
            var lease = LeaseBlob(containerName, blobName, TimeSpan.FromSeconds(60));
            BreakBlobLease(containerName, blobName, lease, 30);
            IBlobServiceClient client = new BlobServiceClient(AccountSettings);
            Thread.Sleep(TimeSpan.FromSeconds(16));

            var properties = await client.GetBlobPropertiesAsync(containerName, blobName);

            Assert.AreEqual(LeaseState.Breaking, properties.LeaseState);
        }
开发者ID:renlesterdg,项目名称:BasicAzureStorageSDK,代码行数:15,代码来源:BlobServiceClientTests.cs

示例10: GetBlobPropertiesAsync_NullBlobName_ThrowsArgumentNullException

        public async void GetBlobPropertiesAsync_NullBlobName_ThrowsArgumentNullException()
        {
            var containerName = _util.GenerateSampleContainerName(_runId);
            string blobName = null;
            IBlobServiceClient client = new BlobServiceClient(AccountSettings);

            var properties = await client.GetBlobPropertiesAsync(containerName, blobName);

            // exception thrown
        }
开发者ID:BrianMcBrayer,项目名称:BasicAzureStorageSDK,代码行数:10,代码来源:BlobOperationsTests.cs

示例11: GetBlobPropertiesAsync_UnleasedBlob_GetsLeaseStateAvailable

        public async void GetBlobPropertiesAsync_UnleasedBlob_GetsLeaseStateAvailable()
        {
            var containerName = GenerateSampleContainerName();
            var blobName = GenerateSampleBlobName();
            CreateContainer(containerName);
            CreateBlockBlob(containerName, blobName);
            IBlobServiceClient client = new BlobServiceClient(AccountSettings);

            var properties = await client.GetBlobPropertiesAsync(containerName, blobName);

            Assert.AreEqual(LeaseState.Available, properties.LeaseState);
        }
开发者ID:renlesterdg,项目名称:BasicAzureStorageSDK,代码行数:12,代码来源:BlobServiceClientTests.cs

示例12: GetBlobPropertiesAsync_ExistingBlockBlob_GetsBlockBlobType

        public async void GetBlobPropertiesAsync_ExistingBlockBlob_GetsBlockBlobType()
        {
            var containerName = GenerateSampleContainerName();
            var blobName = GenerateSampleBlobName();
            CreateContainer(containerName);
            CreateBlockBlob(containerName, blobName);
            IBlobServiceClient client = new BlobServiceClient(AccountSettings);

            var properties = await client.GetBlobPropertiesAsync(containerName, blobName);

            Assert.AreEqual(Communications.BlobService.BlobType.Block, properties.BlobType);
        }
开发者ID:renlesterdg,项目名称:BasicAzureStorageSDK,代码行数:12,代码来源:BlobServiceClientTests.cs

示例13: GetBlobPropertiesAsync_ExistingBlobJustModified_GetsCorrectLastModified

        public async void GetBlobPropertiesAsync_ExistingBlobJustModified_GetsCorrectLastModified()
        {
            var containerName = GenerateSampleContainerName();
            var blobName = GenerateSampleBlobName();
            var createdAt = DateTime.Now;
            CreateContainer(containerName);
            CreateBlockBlob(containerName, blobName);
            IBlobServiceClient client = new BlobServiceClient(AccountSettings);

            var properties = await client.GetBlobPropertiesAsync(containerName, blobName);

            AssertDatesEqualWithTolerance(createdAt, properties.LastModified);
        }
开发者ID:renlesterdg,项目名称:BasicAzureStorageSDK,代码行数:13,代码来源:BlobServiceClientTests.cs

示例14: GetBlobPropertiesAsync_ExistingBlob_HasAnETag

        public async void GetBlobPropertiesAsync_ExistingBlob_HasAnETag()
        {
            var containerName = _util.GenerateSampleContainerName(_runId);
            var blobName = _util.GenerateSampleBlobName(_runId);
            _util.CreateContainer(containerName);
            _util.CreateBlockBlob(containerName, blobName);
            IBlobServiceClient client = new BlobServiceClient(AccountSettings);

            var properties = await client.GetBlobPropertiesAsync(containerName, blobName);

            Assert.IsNotNullOrEmpty(properties.ETag);
        }
开发者ID:BrianMcBrayer,项目名称:BasicAzureStorageSDK,代码行数:12,代码来源:BlobOperationsTests.cs

示例15: GetBlobPropertiesAsync_ExistingPageBlob_GetsPageBlobType

        public async void GetBlobPropertiesAsync_ExistingPageBlob_GetsPageBlobType()
        {
            var containerName = _util.GenerateSampleContainerName(_runId);
            var blobName = _util.GenerateSampleBlobName(_runId);
            _util.CreateContainer(containerName);
            _util.CreatePageBlob(containerName, blobName);
            IBlobServiceClient client = new BlobServiceClient(AccountSettings);

            var properties = await client.GetBlobPropertiesAsync(containerName, blobName);

            Assert.AreEqual(Communications.Common.BlobType.Page, properties.BlobType);
        }
开发者ID:BrianMcBrayer,项目名称:BasicAzureStorageSDK,代码行数:12,代码来源:BlobOperationsTests.cs


注:本文中的BlobServiceClient.GetBlobPropertiesAsync方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。