예제 #1
0
        public void UpdateContentsOfStagingEnvironmentVariableGroupTest()
        {
            using (ShimsContext.Create())
            {
                MockClients clients = new MockClients();

                string json = @"{
  ""abc"": 123,
  ""do-re-me"": ""far-so-la-tee""
}";
                clients.JsonResponse = json;

                clients.ExpectedStatusCode = (HttpStatusCode)200;
                var cfClient = clients.CreateCloudFoundryClient();

                UpdateContentsOfStagingEnvironmentVariableGroupRequest value = new UpdateContentsOfStagingEnvironmentVariableGroupRequest();


                var obj = cfClient.EnvironmentVariableGroups.UpdateContentsOfStagingEnvironmentVariableGroup(value).Result;


                Assert.AreEqual("123", TestUtil.ToTestableString(obj.Abc), true);
                Assert.AreEqual("far-so-la-tee", TestUtil.ToTestableString(obj.Doreme), true);
            }
        }
        public void TestUpdateContentsOfStagingEnvironmentVariableGroupRequest()
        {
            string json = @"{
  ""abc"": 123,
  ""do-re-me"": ""far-so-la-tee""
}";

            UpdateContentsOfStagingEnvironmentVariableGroupRequest request = new UpdateContentsOfStagingEnvironmentVariableGroupRequest();

            request.Abc = 123;
            request.Doreme = "far-so-la-tee";
            string result = JsonConvert.SerializeObject(request, Formatting.None);
            Assert.AreEqual(TestUtil.ToUnformatedJsonString(json), result);
        }
        public void TestUpdateContentsOfStagingEnvironmentVariableGroupRequest()
        {
            string json = @"{
  ""abc"": 123,
  ""do-re-me"": ""far-so-la-tee""
}";

            UpdateContentsOfStagingEnvironmentVariableGroupRequest request = new UpdateContentsOfStagingEnvironmentVariableGroupRequest();

            request.Abc    = 123;
            request.Doreme = "far-so-la-tee";
            string result = JsonConvert.SerializeObject(request, Formatting.None);

            Assert.AreEqual(TestUtil.ToUnformatedJsonString(json), result);
        }
        /// <summary>
        /// Updating the contents of the staging environment variable group
        /// <para>Updates the set of environment variables which will be made available during staging</para>
        /// <para>For detailed information, see online documentation at: "http://apidocs.cloudfoundry.org/195/environment_variable_groups/updating_the_contents_of_the_staging_environment_variable_group.html"</para>
        /// </summary>
        public async Task <UpdateContentsOfStagingEnvironmentVariableGroupResponse> UpdateContentsOfStagingEnvironmentVariableGroup(UpdateContentsOfStagingEnvironmentVariableGroupRequest value)
        {
            UriBuilder uriBuilder = new UriBuilder(this.Client.CloudTarget);

            uriBuilder.Path = "/v2/config/environment_variable_groups/staging";
            var client = this.GetHttpClient();

            client.Uri    = uriBuilder.Uri;
            client.Method = HttpMethod.Put;
            client.Headers.Add(await BuildAuthenticationHeader());
            client.ContentType = "application/x-www-form-urlencoded";
            client.Content     = JsonConvert.SerializeObject(value).ConvertToStream();
            var expectedReturnStatus = 200;
            var response             = await this.SendAsync(client, expectedReturnStatus);

            return(Utilities.DeserializeJson <UpdateContentsOfStagingEnvironmentVariableGroupResponse>(await response.ReadContentAsStringAsync()));
        }
 /// <summary>
 /// Updating the contents of the staging environment variable group
 /// <para>Updates the set of environment variables which will be made available during staging</para>
 /// <para>For detailed information, see online documentation at: "http://apidocs.cloudfoundry.org/195/environment_variable_groups/updating_the_contents_of_the_staging_environment_variable_group.html"</para>
 /// </summary>
 public async Task<UpdateContentsOfStagingEnvironmentVariableGroupResponse> UpdateContentsOfStagingEnvironmentVariableGroup(UpdateContentsOfStagingEnvironmentVariableGroupRequest value)
 {
     UriBuilder uriBuilder = new UriBuilder(this.Client.CloudTarget);
     uriBuilder.Path = "/v2/config/environment_variable_groups/staging";
     var client = this.GetHttpClient();
     client.Uri = uriBuilder.Uri;
     client.Method = HttpMethod.Put;
     var authHeader = await BuildAuthenticationHeader();
     if (!string.IsNullOrWhiteSpace(authHeader.Key))
     {
         client.Headers.Add(authHeader);
     }
     client.ContentType = "application/x-www-form-urlencoded";
     client.Content = JsonConvert.SerializeObject(value).ConvertToStream();
     var expectedReturnStatus = 200;
     var response = await this.SendAsync(client, expectedReturnStatus);
     return Utilities.DeserializeJson<UpdateContentsOfStagingEnvironmentVariableGroupResponse>(await response.ReadContentAsStringAsync());
 }
        public void UpdateContentsOfStagingEnvironmentVariableGroupTest()
        {
            using (ShimsContext.Create())
            {
                MockClients clients = new MockClients();

                string json = @"{
  ""abc"": 123,
  ""do-re-me"": ""far-so-la-tee""
}";
                clients.JsonResponse = json;

                clients.ExpectedStatusCode = (HttpStatusCode)200;
                var cfClient = clients.CreateCloudFoundryClient();

                UpdateContentsOfStagingEnvironmentVariableGroupRequest value = new UpdateContentsOfStagingEnvironmentVariableGroupRequest();


                var obj = cfClient.EnvironmentVariableGroups.UpdateContentsOfStagingEnvironmentVariableGroup(value).Result;


                Assert.AreEqual("123", TestUtil.ToTestableString(obj.Abc), true);
                Assert.AreEqual("far-so-la-tee", TestUtil.ToTestableString(obj.Doreme), true);

            }
        }