示例#1
0
        public async Task PutBlockListScenarioTest(string containerName, string blobName, List <PutBlockListItem> blocks, BlobProperties blobProperties, string leaseId, HttpStatusCode?expectedError)
        {
            HttpRequestMessage request = BlobTests.PutBlockListRequest(BlobContext, containerName, blobName, blobProperties, AccessCondition.GenerateLeaseCondition(leaseId));

            Assert.IsTrue(request != null, "Failed to create HttpRequestMessage");
            byte[] content;
            using (MemoryStream stream = new MemoryStream())
            {
                BlobRequest.WriteBlockListBody(blocks, stream);
                stream.Seek(0, SeekOrigin.Begin);
                content = new byte[stream.Length];
                stream.Read(content, 0, content.Length);
            }
            //HttpRequestHandler.SetContentLength(request, content.Length);
            request.Content = new ByteArrayContent(content);
            using (HttpResponseMessage response = await BlobTestUtils.GetResponse(request, BlobContext))
            {
                BlobTests.PutBlockListResponse(response, BlobContext, expectedError);
            }
        }