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


C# BlobServiceClient.PutBlockList方法代码示例

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


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

示例1: PutBlockList_WithBlobContentLanguage_UploadsWithSpecifiedBlobContentLanguage

        public void PutBlockList_WithBlobContentLanguage_UploadsWithSpecifiedBlobContentLanguage()
        {
            const string dataPerBlock = "foo";
            const string expectedContentLanguage = "gibberish";
            var containerName = _util.GenerateSampleContainerName(_runId);
            var blobName = _util.GenerateSampleBlobName(_runId);
            _util.CreateContainer(containerName);
            var blockListBlockIds = _util.CreateBlockIdList(3, PutBlockListListType.Latest);
            var blockIds = _util.GetIdsFromBlockIdList(blockListBlockIds);
            _util.CreateBlockList(containerName, blobName, blockIds, dataPerBlock);
            IBlobServiceClient client = new BlobServiceClient(AccountSettings);

            client.PutBlockList(containerName, blobName, blockListBlockIds, contentLanguage: expectedContentLanguage);

            var blob = _util.AssertBlobExists(containerName, blobName, BlobType.BlockBlob);
            Assert.AreEqual(expectedContentLanguage, blob.Properties.ContentLanguage);
        }
开发者ID:BrianMcBrayer,项目名称:BasicAzureStorageSDK,代码行数:17,代码来源:BlobOperationsTests.cs

示例2: PutBlockList_WithMetadata_UploadsMetadata

        public void PutBlockList_WithMetadata_UploadsMetadata()
        {
            const string dataPerBlock = "foo";
            var expectedMetadata = new Dictionary<string, string>(){
                { "firstValue", "1" },
                { "secondValue", "2"}
            };
            var containerName = _util.GenerateSampleContainerName(_runId);
            var blobName = _util.GenerateSampleBlobName(_runId);
            _util.CreateContainer(containerName);
            var blockListBlockIds = _util.CreateBlockIdList(3, PutBlockListListType.Latest);
            var blockIds = _util.GetIdsFromBlockIdList(blockListBlockIds);
            _util.CreateBlockList(containerName, blobName, blockIds, dataPerBlock);
            IBlobServiceClient client = new BlobServiceClient(AccountSettings);

            client.PutBlockList(containerName, blobName, blockListBlockIds, metadata: expectedMetadata);

            var blob = _util.AssertBlobExists(containerName, blobName, BlobType.BlockBlob);
            Assert.IsTrue(blob.Metadata.Any(m => m.Key == "firstValue" && m.Value == "1"), "First value is missing or incorrect");
            Assert.IsTrue(blob.Metadata.Any(m => m.Key == "secondValue" && m.Value == "2"), "Second value is missing or incorrect");
        }
开发者ID:BrianMcBrayer,项目名称:BasicAzureStorageSDK,代码行数:21,代码来源:BlobOperationsTests.cs

示例3: PutBlockList_WithBlobContentMD5_UploadsWithSpecifiedBlobContentMD5

        public void PutBlockList_WithBlobContentMD5_UploadsWithSpecifiedBlobContentMD5()
        {
            const string dataPerBlock = "foo";
            const string expectedData = "foofoofoo";
            var expectedContentMD5 = Convert.ToBase64String((MD5.Create()).ComputeHash(Encoding.Unicode.GetBytes(expectedData)));
            var containerName = _util.GenerateSampleContainerName(_runId);
            var blobName = _util.GenerateSampleBlobName(_runId);
            _util.CreateContainer(containerName);
            var blockListBlockIds = _util.CreateBlockIdList(3, PutBlockListListType.Latest);
            var blockIds = _util.GetIdsFromBlockIdList(blockListBlockIds);
            _util.CreateBlockList(containerName, blobName, blockIds, dataPerBlock);
            IBlobServiceClient client = new BlobServiceClient(AccountSettings);

            client.PutBlockList(containerName, blobName, blockListBlockIds, blobContentMD5: expectedContentMD5);

            var blob = _util.AssertBlobExists(containerName, blobName, BlobType.BlockBlob);
            Assert.AreEqual(expectedContentMD5, blob.Properties.ContentMD5);
        }
开发者ID:BrianMcBrayer,项目名称:BasicAzureStorageSDK,代码行数:18,代码来源:BlobOperationsTests.cs

示例4: PutBlockList_LeasedBlobWithInvalidLeaseGiven_ThrowsArgumentException

        public void PutBlockList_LeasedBlobWithInvalidLeaseGiven_ThrowsArgumentException()
        {
            var containerName = _util.GenerateSampleContainerName(_runId);
            var blobName = _util.GenerateSampleBlobName(_runId);
            var blockListBlockIds = _util.CreateBlockIdList(3, PutBlockListListType.Latest);
            IBlobServiceClient client = new BlobServiceClient(AccountSettings);

            client.PutBlockList(containerName, blobName, blockListBlockIds, leaseId: InvalidLeaseId);

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

示例5: PutBlockList_InvalidBlockId_ThrowsInvalidBlockListAzureException

        public void PutBlockList_InvalidBlockId_ThrowsInvalidBlockListAzureException()
        {
            const string dataPerBlock = "foo";
            var containerName = _util.GenerateSampleContainerName(_runId);
            var blobName = _util.GenerateSampleBlobName(_runId);
            _util.CreateContainer(containerName);
            var blockListBlockIds = _util.CreateBlockIdList(3, PutBlockListListType.Latest);
            var blockIds = _util.GetIdsFromBlockIdList(blockListBlockIds);
            blockListBlockIds.Add(new BlockListBlockId
            {
                Id = Base64Converter.ConvertToBase64("id4"),
                ListType = PutBlockListListType.Latest
            });
            _util.CreateBlockList(containerName, blobName, blockIds, dataPerBlock);
            IBlobServiceClient client = new BlobServiceClient(AccountSettings);

            client.PutBlockList(containerName, blobName, blockListBlockIds);

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

示例6: PutBlockList_LeasedBlobWithIncorrectLeaseGiven_ThrowsLeaseIdMismatchWithBlobOperationAzureException

        public void PutBlockList_LeasedBlobWithIncorrectLeaseGiven_ThrowsLeaseIdMismatchWithBlobOperationAzureException()
        {
            const string dataPerBlock = "foo";
            var containerName = _util.GenerateSampleContainerName(_runId);
            var blobName = _util.GenerateSampleBlobName(_runId);
            _util.CreateContainer(containerName);
            _util.CreateBlockBlob(containerName, blobName);
            var blockListBlockIds = _util.CreateBlockIdList(3, PutBlockListListType.Latest);
            var blockIds = _util.GetIdsFromBlockIdList(blockListBlockIds);
            _util.CreateBlockList(containerName, blobName, blockIds, dataPerBlock);
            _util.LeaseBlob(containerName, blobName);
            IBlobServiceClient client = new BlobServiceClient(AccountSettings);

            client.PutBlockList(containerName, blobName, blockListBlockIds, leaseId: GetGuidString());

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

示例7: PutBlockList_LeasedBlobCorrectLeaseSpecified_CreatesBlockBlobFromLatestBlocks

        public void PutBlockList_LeasedBlobCorrectLeaseSpecified_CreatesBlockBlobFromLatestBlocks()
        {
            const string dataPerBlock = "foo";
            const string expectedData = "foofoofoo";
            var containerName = _util.GenerateSampleContainerName(_runId);
            var blobName = _util.GenerateSampleBlobName(_runId);
            _util.CreateContainer(containerName);
            _util.CreateBlockBlob(containerName, blobName);
            var blockListBlockIds = _util.CreateBlockIdList(3, PutBlockListListType.Latest);
            var blockIds = _util.GetIdsFromBlockIdList(blockListBlockIds);
            _util.CreateBlockList(containerName, blobName, blockIds, dataPerBlock);
            var lease = _util.LeaseBlob(containerName, blobName);
            IBlobServiceClient client = new BlobServiceClient(AccountSettings);

            client.PutBlockList(containerName, blobName, blockListBlockIds, leaseId: lease);

            _util.AssertBlobExists(containerName, blobName, BlobType.BlockBlob);
            _util.AssertBlobContainsData(containerName, blobName, BlobType.BlockBlob, Encoding.Unicode.GetBytes(expectedData));
        }
开发者ID:BrianMcBrayer,项目名称:BasicAzureStorageSDK,代码行数:19,代码来源:BlobOperationsTests.cs

示例8: PutBlockList_WithBlobContentEncoding_UploadsWithSpecifiedBlobContentEncoding

        public void PutBlockList_WithBlobContentEncoding_UploadsWithSpecifiedBlobContentEncoding()
        {
            const string dataPerBlock = "foo";
            const string expectedContentEncoding = "UTF32";
            var containerName = GenerateSampleContainerName();
            var blobName = GenerateSampleBlobName();
            CreateContainer(containerName);
            var blockListBlockIds = CreateBlockIdList(3, BlockListListType.Latest);
            var blockIds = GetIdsFromBlockIdList(blockListBlockIds);
            CreateBlockList(containerName, blobName, blockIds, dataPerBlock, Encoding.UTF32);
            IBlobServiceClient client = new BlobServiceClient(AccountSettings);

            client.PutBlockList(containerName, blobName, blockListBlockIds, contentEncoding: expectedContentEncoding);

            var blob = AssertBlobExists(containerName, blobName, BlobType.BlockBlob);
            Assert.AreEqual(expectedContentEncoding, blob.Properties.ContentEncoding);
        }
开发者ID:renlesterdg,项目名称:BasicAzureStorageSDK,代码行数:17,代码来源:BlobServiceClientTests.cs

示例9: PutBlockList_LeasedBlobWithNoLeaseGiven_ThrowsLeaseIdMissingAzureException

        public void PutBlockList_LeasedBlobWithNoLeaseGiven_ThrowsLeaseIdMissingAzureException()
        {
            const string dataPerBlock = "foo";
            var containerName = GenerateSampleContainerName();
            var blobName = GenerateSampleBlobName();
            CreateContainer(containerName);
            CreateBlockBlob(containerName, blobName);
            var blockListBlockIds = CreateBlockIdList(3, BlockListListType.Latest);
            var blockIds = GetIdsFromBlockIdList(blockListBlockIds);
            CreateBlockList(containerName, blobName, blockIds, dataPerBlock);
            LeaseBlob(containerName, blobName);
            IBlobServiceClient client = new BlobServiceClient(AccountSettings);

            client.PutBlockList(containerName, blobName, blockListBlockIds);

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

示例10: PutBlockList_RequiredArgsOnly_CreatesBlockBlobFromLatestBlocks

        public void PutBlockList_RequiredArgsOnly_CreatesBlockBlobFromLatestBlocks()
        {
            const string dataPerBlock = "foo";
            const string expectedData = "foofoofoo";
            var containerName = GenerateSampleContainerName();
            var blobName = GenerateSampleBlobName();
            CreateContainer(containerName);
            var blockListBlockIds = CreateBlockIdList(3, BlockListListType.Latest);
            var blockIds = GetIdsFromBlockIdList(blockListBlockIds);
            CreateBlockList(containerName, blobName, blockIds, dataPerBlock);
            IBlobServiceClient client = new BlobServiceClient(AccountSettings);

            client.PutBlockList(containerName, blobName, blockListBlockIds);

            AssertBlobExists(containerName, blobName, BlobType.BlockBlob);
            AssertBlobContainsData(containerName, blobName, BlobType.BlockBlob, Encoding.Unicode.GetBytes(expectedData));
        }
开发者ID:renlesterdg,项目名称:BasicAzureStorageSDK,代码行数:17,代码来源:BlobServiceClientTests.cs


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