public void UpdateContentsOfRunningEnvironmentVariableGroupTest() { 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(); UpdateContentsOfRunningEnvironmentVariableGroupRequest value = new UpdateContentsOfRunningEnvironmentVariableGroupRequest(); var obj = cfClient.EnvironmentVariableGroups.UpdateContentsOfRunningEnvironmentVariableGroup(value).Result; Assert.AreEqual("123", TestUtil.ToTestableString(obj.Abc), true); Assert.AreEqual("far-so-la-tee", TestUtil.ToTestableString(obj.Doreme), true); } }
public void TestUpdateContentsOfRunningEnvironmentVariableGroupRequest() { string json = @"{ ""abc"": 123, ""do-re-me"": ""far-so-la-tee"" }"; UpdateContentsOfRunningEnvironmentVariableGroupRequest request = new UpdateContentsOfRunningEnvironmentVariableGroupRequest(); request.Abc = 123; request.Doreme = "far-so-la-tee"; string result = JsonConvert.SerializeObject(request, Formatting.None); Assert.AreEqual(TestUtil.ToUnformatedJsonString(json), result); }
public void TestUpdateContentsOfRunningEnvironmentVariableGroupRequest() { string json = @"{ ""abc"": 123, ""do-re-me"": ""far-so-la-tee"" }"; UpdateContentsOfRunningEnvironmentVariableGroupRequest request = new UpdateContentsOfRunningEnvironmentVariableGroupRequest(); 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 running environment variable group /// <para>Updates the set of environment variables which will be made available to all running apps</para> /// <para>For detailed information, see online documentation at: "http://apidocs.cloudfoundry.org/195/environment_variable_groups/updating_the_contents_of_the_running_environment_variable_group.html"</para> /// </summary> public async Task <UpdateContentsOfRunningEnvironmentVariableGroupResponse> UpdateContentsOfRunningEnvironmentVariableGroup(UpdateContentsOfRunningEnvironmentVariableGroupRequest value) { UriBuilder uriBuilder = new UriBuilder(this.Client.CloudTarget); uriBuilder.Path = "/v2/config/environment_variable_groups/running"; 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 <UpdateContentsOfRunningEnvironmentVariableGroupResponse>(await response.ReadContentAsStringAsync())); }
/// <summary> /// Updating the contents of the running environment variable group /// <para>Updates the set of environment variables which will be made available to all running apps</para> /// <para>For detailed information, see online documentation at: "http://apidocs.cloudfoundry.org/195/environment_variable_groups/updating_the_contents_of_the_running_environment_variable_group.html"</para> /// </summary> public async Task<UpdateContentsOfRunningEnvironmentVariableGroupResponse> UpdateContentsOfRunningEnvironmentVariableGroup(UpdateContentsOfRunningEnvironmentVariableGroupRequest value) { UriBuilder uriBuilder = new UriBuilder(this.Client.CloudTarget); uriBuilder.Path = "/v2/config/environment_variable_groups/running"; 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<UpdateContentsOfRunningEnvironmentVariableGroupResponse>(await response.ReadContentAsStringAsync()); }
public void UpdateContentsOfRunningEnvironmentVariableGroupTest() { 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(); UpdateContentsOfRunningEnvironmentVariableGroupRequest value = new UpdateContentsOfRunningEnvironmentVariableGroupRequest(); var obj = cfClient.EnvironmentVariableGroups.UpdateContentsOfRunningEnvironmentVariableGroup(value).Result; Assert.AreEqual("123", TestUtil.ToTestableString(obj.Abc), true); Assert.AreEqual("far-so-la-tee", TestUtil.ToTestableString(obj.Doreme), true); } }