Пример #1
0
        public void TestAssociateAuditorWithOrganizationByUsernameRequest()
        {
            string json = @"{
  ""username"": ""*****@*****.**""
}";

            AssociateAuditorWithOrganizationByUsernameRequest request = new AssociateAuditorWithOrganizationByUsernameRequest();

            request.Username = "******";
            string result = JsonConvert.SerializeObject(request, Formatting.None);

            Assert.AreEqual(TestUtil.ToUnformatedJsonString(json), result);
        }
        /// <summary>
        /// Associate Auditor with the Organization by Username
        /// <para>For detailed information, see online documentation at: "http://apidocs.cloudfoundry.org/250/organizations/associate_auditor_with_the_organization_by_username.html"</para>
        /// </summary>
        public async Task <AssociateAuditorWithOrganizationByUsernameResponse> AssociateAuditorWithOrganizationByUsername(Guid?guid, AssociateAuditorWithOrganizationByUsernameRequest value)
        {
            UriBuilder uriBuilder = new UriBuilder(this.Client.CloudTarget);

            uriBuilder.Path = string.Format(CultureInfo.InvariantCulture, "v2/organizations/{0}/auditors", guid);
            var client = this.GetHttpClient();

            client.Uri    = uriBuilder.Uri;
            client.Method = HttpMethod.Put;


            client.Content = ((string)JsonConvert.SerializeObject(value)).ConvertToStream();
            var expectedReturnStatus = 201;
            var response             = await this.SendAsync(client, expectedReturnStatus);

            return(Utilities.DeserializeJson <AssociateAuditorWithOrganizationByUsernameResponse>(await response.Content.ReadAsStringAsync()));
        }