Пример #1
0
        public async Task BlobProtocolPutGetBlockListCloudOwnerSync()
        {
            string blockId1 = Convert.ToBase64String(new byte[] { 99, 100, 101 });
            string blockId2 = Convert.ToBase64String(new byte[] { 102, 103, 104 });

            // use a unique name since temp blocks from previous runs can exist
            string                  blobName       = "blob2" + DateTime.UtcNow.Ticks;
            BlobProperties          blobProperties = new BlobProperties();
            List <PutBlockListItem> blocks         = new List <PutBlockListItem>();
            PutBlockListItem        block1         = new PutBlockListItem(blockId1, BlockSearchMode.Uncommitted);

            blocks.Add(block1);
            PutBlockListItem block2 = new PutBlockListItem(blockId2, BlockSearchMode.Uncommitted);

            blocks.Add(block2);
            try
            {
                await cloudOwnerSync.PutBlockScenarioTest(cloudSetup.ContainerName, blobName, blockId1, cloudSetup.LeaseId, cloudSetup.Content, null);

                await cloudOwnerSync.GetBlockListScenarioTest(cloudSetup.ContainerName, blobName, BlockListingFilter.All, cloudSetup.LeaseId, null, blockId1);

                await cloudOwnerSync.GetBlockListScenarioTest(cloudSetup.ContainerName, blobName, BlockListingFilter.Uncommitted, cloudSetup.LeaseId, null, blockId1);

                await cloudOwnerSync.GetBlockListScenarioTest(cloudSetup.ContainerName, blobName, BlockListingFilter.Committed, cloudSetup.LeaseId, null);

                await cloudOwnerSync.PutBlockScenarioTest(cloudSetup.ContainerName, blobName, blockId2, cloudSetup.LeaseId, cloudSetup.Content, null);

                await cloudOwnerSync.GetBlockListScenarioTest(cloudSetup.ContainerName, blobName, BlockListingFilter.All, cloudSetup.LeaseId, null, blockId1, blockId2);

                await cloudOwnerSync.GetBlockListScenarioTest(cloudSetup.ContainerName, blobName, BlockListingFilter.Uncommitted, cloudSetup.LeaseId, null, blockId1, blockId2);

                await cloudOwnerSync.GetBlockListScenarioTest(cloudSetup.ContainerName, blobName, BlockListingFilter.Committed, cloudSetup.LeaseId, null);

                await cloudOwnerSync.PutBlockListScenarioTest(cloudSetup.ContainerName, blobName, blocks, blobProperties, cloudSetup.LeaseId, null);

                await cloudOwnerSync.GetBlockListScenarioTest(cloudSetup.ContainerName, blobName, BlockListingFilter.All, cloudSetup.LeaseId, null, blockId1, blockId2);

                await cloudOwnerSync.GetBlockListScenarioTest(cloudSetup.ContainerName, blobName, BlockListingFilter.Uncommitted, cloudSetup.LeaseId, null);

                await cloudOwnerSync.GetBlockListScenarioTest(cloudSetup.ContainerName, blobName, BlockListingFilter.Committed, cloudSetup.LeaseId, null, blockId1, blockId2);
            }
            finally
            {
                await cloudOwnerSync.DeleteBlob(cloudSetup.ContainerName, blobName);
            }
        }