Exemplo n.º 1
0
        public void PatchTableService()
        {
            var response = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(ExpectedResults.TableServiceGetResponse)
            };

            var handler = new RecordedDelegatingHandler(response)
            {
                StatusCodeToReturn = HttpStatusCode.OK
            };

            var subscriptionId = Guid.NewGuid().ToString();

            var token  = new TokenCloudCredentials(subscriptionId, Constants.TokenString);
            var client = GetClient(handler, token);

            var settings = new TableServiceWritableSettings
            {
                FrontEndCallbackThreadsCount = 100
            };

            var patchParam = new TableServicePatchParameters
            {
                TableService = new TableServiceRequest()
                {
                    Settings = settings
                }
            };

            var result = client.TableService.Patch(
                Constants.ResourceGroupName,
                Constants.FarmId,
                patchParam);

            // validate requestor
            Assert.Equal(handler.Method.Method, "PATCH", StringComparer.OrdinalIgnoreCase);

            var expectedUri = string.Format(
                TableServiceUriTemplate,
                Constants.BaseUri,
                subscriptionId,
                Constants.ResourceGroupName,
                Constants.FarmId);

            Assert.Equal(handler.Uri.AbsoluteUri, expectedUri);

            CompareExpectedResult(result.Resource.TableService);
        }
Exemplo n.º 2
0
        protected override void Execute()
        {
            string confirmString;
            TableServiceWritableSettings settings = Tools.ToSettingsObject <SetTableService, TableServiceWritableSettings>(this, out confirmString);

            if (ShouldProcess(
                    Resources.SetServiceDescription.FormatInvariantCulture(Resources.TableService, confirmString),
                    Resources.SetServiceWarning.FormatInvariantCulture(Resources.TableService, confirmString),
                    Resources.ShouldProcessCaption))
            {
                TableServiceGetResponse result = Client.TableService.Patch(ResourceGroupName, FarmName,
                                                                           new TableServicePatchParameters
                {
                    TableService = new TableServiceRequest
                    {
                        Settings = settings
                    }
                });
                WriteObject(new TableServiceResponse(result.Resource));
            }
        }
Exemplo n.º 3
0
        public void PatchTableService()
        {
            var response = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(ExpectedResults.TableServiceGetResponse)
            };

            var handler = new RecordedDelegatingHandler(response)
            {
                StatusCodeToReturn = HttpStatusCode.OK
            };

            var subscriptionId = Guid.NewGuid().ToString();

            var token = new TokenCloudCredentials(subscriptionId, Constants.TokenString);
            var client = GetClient(handler, token);

            var settings = new TableServiceWritableSettings
            {
                FrontEndCallbackThreadsCount = 100
            };

            var patchParam = new TableServicePatchParameters
            {
                TableService = new TableServiceRequest()
                {
                    Settings = settings
                }
            };

            var result = client.TableService.Patch(
                Constants.ResourceGroupName,
                Constants.FarmId,
                patchParam);

            // validate requestor
            Assert.Equal(handler.Method.Method, "PATCH", StringComparer.OrdinalIgnoreCase);

            var expectedUri = string.Format(
                TableServiceUriTemplate,
                Constants.BaseUri,
                subscriptionId,
                Constants.ResourceGroupName,
                Constants.FarmId);

            Assert.Equal(handler.Uri.AbsoluteUri, expectedUri);

            CompareExpectedResult(result.Resource.TableService);
        }