Esempio n. 1
0
        public void PatchQueueService()
        {
            var response = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(ExpectedResults.QueueServiceGetResponse)
            };

            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 QueueServiceWritableSettings
            {
                FrontEndCallbackThreadsCount = 100
            };

            var patchParam = new QueueServicePatchParameters
            {
                QueueService = new QueueServiceRequest()
                {
                    Settings = settings
                }
            };

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

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

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

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

            CompareExpectedResult(result.Resource.QueueService);
        }
Esempio n. 2
0
        public void PatchQueueService()
        {
            var response = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(ExpectedResults.QueueServiceGetResponse)
            };

            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 QueueServiceWritableSettings
            {
                FrontEndCallbackThreadsCount = 100
            };

            var patchParam = new QueueServicePatchParameters
            {
                QueueService = new QueueServiceRequest()
                {
                    Settings = settings
                }
            };

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

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

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

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

            CompareExpectedResult(result.Resource.QueueService);
        }