예제 #1
0
        public void BlobProtocolGetContainerWithEmptyHeader()
        {
            ListingContext listingContext = new ListingContext("default", null);

            cloudOwnerAsync.CreateContainer("emptyheadercontainer", true);

            HttpWebRequest request = BlobTests.ListContainersRequest(cloudOwnerAsync.BlobContext, listingContext);

            Assert.IsTrue(request != null, "Failed to create HttpWebRequest");
            if (cloudOwnerAsync.BlobContext.Credentials != null)
            {
                BlobTests.SignRequest(request, cloudOwnerAsync.BlobContext);
                request.Headers.Add("x-ms-blob-application-metadata", "");
            }
            using (HttpWebResponse response = BlobTestUtils.GetResponse(request, cloudOwnerAsync.BlobContext))
            {
                BlobTests.ListContainersResponse(response, cloudOwnerAsync.BlobContext, null);
            }

            request = BlobTests.ListContainersRequest(cloudOwnerAsync.BlobContext, listingContext);
            Assert.IsTrue(request != null, "Failed to create HttpWebRequest");
            if (cloudOwnerAsync.BlobContext.Credentials != null)
            {
                request.Headers.Add("x-ms-blob-application-metadata", "");
                BlobTests.SignRequest(request, cloudOwnerAsync.BlobContext);
            }
            using (HttpWebResponse response = BlobTestUtils.GetResponse(request, cloudOwnerAsync.BlobContext))
            {
                BlobTests.ListContainersResponse(response, cloudOwnerAsync.BlobContext, HttpStatusCode.OK);
            }
        }
예제 #2
0
        public async Task BlobProtocolGetContainerWithEmptyHeader()
        {
            ListingContext listingContext = new ListingContext("default", null);
            await cloudOwnerAsync.CreateContainer("emptyheadercontainer", true);

            HttpRequestMessage request = BlobTests.ListContainersRequest(cloudOwnerAsync.BlobContext, listingContext);

            Assert.IsTrue(request != null, "Failed to create HttpRequestMessage");
            if (cloudOwnerAsync.BlobContext.Credentials != null)
            {
                request.Headers.Add("x-ms-blob-application-metadata", "");
            }
            using (HttpResponseMessage response = await BlobTestUtils.GetResponse(request, cloudOwnerAsync.BlobContext))
            {
                BlobTests.ListContainersResponse(response, cloudOwnerAsync.BlobContext, HttpStatusCode.OK /*HttpStatusCode.Forbidden*/);
            }

            request = BlobTests.ListContainersRequest(cloudOwnerAsync.BlobContext, listingContext);
            Assert.IsTrue(request != null, "Failed to create HttpRequestMessage");
            if (cloudOwnerAsync.BlobContext.Credentials != null)
            {
                request.Headers.Add("x-ms-blob-application-metadata", "");
            }
            using (HttpResponseMessage response = await BlobTestUtils.GetResponse(request, cloudOwnerAsync.BlobContext))
            {
                BlobTests.ListContainersResponse(response, cloudOwnerAsync.BlobContext, HttpStatusCode.OK);
            }
        }
예제 #3
0
        public void BlobProtocolListContainersCloud()
        {
            ListingContext listingContext = new ListingContext("default", null);

            cloudOwnerAsync.ListContainersScenarioTest(listingContext, null, cloudSetup.ContainerName);

            cloudSetup.CreateContainer("newcontainer1", true);
            cloudSetup.CreateContainer("newcontainer2", true);

            try
            {
                cloudOwnerAsync.ListContainersScenarioTest(listingContext, null, cloudSetup.ContainerName);
                listingContext = new ListingContext("newcontainer", 10);
                cloudOwnerAsync.ListContainersScenarioTest(listingContext, null, "newcontainer1", "newcontainer2");
            }
            finally
            {
                cloudSetup.DeleteContainer("newcontainer1");
                cloudSetup.DeleteContainer("newcontainer2");
            }
        }