Пример #1
0
        private static void TestQueueFetchAttributes(LocationMode?optionsLocationMode, LocationMode clientLocationMode, StorageLocation initialLocation, IList <RetryContext> retryContextList, IList <RetryInfo> retryInfoList)
        {
            CloudQueue queue = GenerateCloudQueueClient().GetQueueReference(QueueTestBase.GenerateNewQueueName());

            using (MultiLocationTestHelper helper = new MultiLocationTestHelper(queue.ServiceClient.StorageUri, initialLocation, retryContextList, retryInfoList))
            {
                queue.ServiceClient.LocationMode = clientLocationMode;
                QueueRequestOptions options = new QueueRequestOptions()
                {
                    LocationMode = optionsLocationMode,
                    RetryPolicy  = helper.RetryPolicy,
                };

                TestHelper.ExpectedException(
                    () => queue.FetchAttributes(options, helper.OperationContext),
                    "FetchAttributes on a non-existing queue should fail",
                    HttpStatusCode.NotFound);
            }
        }
Пример #2
0
        private static void TestTableRetrieve(LocationMode?optionsLocationMode, LocationMode clientLocationMode, StorageLocation initialLocation, IList <RetryContext> retryContextList, IList <RetryInfo> retryInfoList)
        {
            CloudTable table = GenerateCloudTableClient().GetTableReference(TableTestBase.GenerateRandomTableName());

            using (MultiLocationTestHelper helper = new MultiLocationTestHelper(table.ServiceClient.StorageUri, initialLocation, retryContextList, retryInfoList))
            {
                table.ServiceClient.LocationMode = clientLocationMode;
                TableRequestOptions options = new TableRequestOptions()
                {
                    LocationMode = optionsLocationMode,
                    RetryPolicy  = helper.RetryPolicy,
                };

                TestHelper.ExpectedException(
                    () => table.GetPermissions(options, helper.OperationContext),
                    "GetPermissions on a non-existing table should fail",
                    HttpStatusCode.NotFound);
            }
        }
Пример #3
0
        private static void TestContainerFetchAttributes(LocationMode?optionsLocationMode, LocationMode clientLocationMode, StorageLocation initialLocation, IList <RetryContext> retryContextList, IList <RetryInfo> retryInfoList)
        {
            CloudBlobContainer container = BlobTestBase.GetRandomContainerReference();

            using (MultiLocationTestHelper helper = new MultiLocationTestHelper(container.ServiceClient.StorageUri, initialLocation, retryContextList, retryInfoList))
            {
                container.ServiceClient.LocationMode = clientLocationMode;
                BlobRequestOptions options = new BlobRequestOptions()
                {
                    LocationMode = optionsLocationMode,
                    RetryPolicy  = helper.RetryPolicy,
                };

                TestHelper.ExpectedException(
                    () => container.FetchAttributes(null, options, helper.OperationContext),
                    "FetchAttributes on a non-existing container should fail",
                    HttpStatusCode.NotFound);
            }
        }
        private static void TestShareFetchAttributes(LocationMode?optionsLocationMode, LocationMode clientLocationMode, StorageLocation initialLocation, IList <RetryContext> retryContextList, IList <RetryInfo> retryInfoList)
        {
            CloudFileShare share = FileTestBase.GetRandomShareReference();

            using (MultiLocationTestHelper helper = new MultiLocationTestHelper(share.ServiceClient.StorageUri, initialLocation, retryContextList, retryInfoList))
            {
                share.ServiceClient.DefaultRequestOptions.LocationMode = clientLocationMode;
                FileRequestOptions options = new FileRequestOptions()
                {
                    LocationMode = optionsLocationMode,
                    RetryPolicy  = helper.RetryPolicy,
                };

                TestHelper.ExpectedException(
                    () => share.FetchAttributes(null, options, helper.OperationContext),
                    "FetchAttributes on a non-existing share should fail",
                    HttpStatusCode.NotFound);
            }
        }
Пример #5
0
        private static async Task TestTableRetrieveAsync(LocationMode? optionsLocationMode, LocationMode clientLocationMode, StorageLocation initialLocation, IList<RetryContext> retryContextList, IList<RetryInfo> retryInfoList)
        {
            CloudTable table = GenerateCloudTableClient().GetTableReference(TableTestBase.GenerateRandomTableName());
            using (MultiLocationTestHelper helper = new MultiLocationTestHelper(table.ServiceClient.StorageUri, initialLocation, retryContextList, retryInfoList))
            {
                table.ServiceClient.DefaultRequestOptions.LocationMode = clientLocationMode;
                TableRequestOptions options = new TableRequestOptions()
                {
                    LocationMode = optionsLocationMode,
                    RetryPolicy = helper.RetryPolicy,
                };

                await TestHelper.ExpectedExceptionAsync(
                    async () => await table.GetPermissionsAsync(options, helper.OperationContext),
                    helper.OperationContext,
                    "GetPermissions on a non-existing table should fail",
                    HttpStatusCode.NotFound);
            }
        }
Пример #6
0
        private static async Task TestQueueFetchAttributesAsync(LocationMode? optionsLocationMode, LocationMode clientLocationMode, StorageLocation initialLocation, IList<RetryContext> retryContextList, IList<RetryInfo> retryInfoList)
        {
            CloudQueue queue = GenerateCloudQueueClient().GetQueueReference(QueueTestBase.GenerateNewQueueName());
            using (MultiLocationTestHelper helper = new MultiLocationTestHelper(queue.ServiceClient.StorageUri, initialLocation, retryContextList, retryInfoList))
            {
                queue.ServiceClient.DefaultRequestOptions.LocationMode = clientLocationMode;
                QueueRequestOptions options = new QueueRequestOptions()
                {
                    LocationMode = optionsLocationMode,
                    RetryPolicy = helper.RetryPolicy,
                };

                await TestHelper.ExpectedExceptionAsync(
                    async () => await queue.FetchAttributesAsync(options, helper.OperationContext),
                    helper.OperationContext,
                    "FetchAttributes on a non-existing queue should fail",
                    HttpStatusCode.NotFound);
            }
        }
Пример #7
0
        private static async Task TestContainerFetchAttributesAsync(LocationMode? optionsLocationMode, LocationMode clientLocationMode, StorageLocation initialLocation, IList<RetryContext> retryContextList, IList<RetryInfo> retryInfoList)
        {
            CloudBlobContainer container = BlobTestBase.GetRandomContainerReference();
            using (MultiLocationTestHelper helper = new MultiLocationTestHelper(container.ServiceClient.StorageUri, initialLocation, retryContextList, retryInfoList))
            {
                container.ServiceClient.DefaultRequestOptions.LocationMode = clientLocationMode;
                BlobRequestOptions options = new BlobRequestOptions()
                {
                    LocationMode = optionsLocationMode,
                    RetryPolicy = helper.RetryPolicy,
                };

                await TestHelper.ExpectedExceptionAsync(
                    async () => await container.FetchAttributesAsync(null, options, helper.OperationContext),
                    helper.OperationContext,
                    "FetchAttributes on a non-existing container should fail",
                    HttpStatusCode.NotFound);
            }
        }