public void TestUpdateProfile()
        {
            var info = new UpdateProfileInfo();
            info.ScreenName = "A-Microblog-API-Test";
            info.Province = 31;
            info.City = 7;
            info.Gender = "f";
            info.Description = "I am a test machine.";

            // No permssion to call this API.
            var result = AMicroblog.UpdateProfile(info);

            Assert.IsNotNull(result);
        }
예제 #2
0
 /// <summary>
 /// The async implementation of <see cref="UpdateProfile"/>
 /// </summary>
 public static void UpdateProfileAsync(AsyncCallback<UserInfo> callback, UpdateProfileInfo updateProfileInfo)
 {
     ValidateArgument(updateProfileInfo, "updateProfileInfo");
     var requester = new OAuthHttpPost(APIUri.UpdateProfileImage);
     if(!string.IsNullOrEmpty(updateProfileInfo.ScreenName))
         requester.Params.Add("name", updateProfileInfo.ScreenName);
     if (!string.IsNullOrEmpty(updateProfileInfo.Gender))
         requester.Params.Add("gender", updateProfileInfo.Gender);
     if (!string.IsNullOrEmpty(updateProfileInfo.Description))
         requester.Params.Add("description", updateProfileInfo.Description);
     if (updateProfileInfo.Province.HasValue)
         requester.Params.Add("province", updateProfileInfo.Province.Value.ToString(InvariantCulture));
     if (updateProfileInfo.City.HasValue)
         requester.Params.Add("city", updateProfileInfo.City.Value.ToString(InvariantCulture));
     requester.RequestAsync(delegate(AsyncCallResult<string> result)
     {
         ProcessAsyncCallbackResponse(result, callback);
     });
 }