コード例 #1
0
        public void TestGetUserInfo()
        {
            IGetUserInfoApi api = new GetUserInfoApi(context);

            api.OpenId = GetOpenId();
            var response = api.Execute();

            Assert.AreEqual(1, response.Sex);    //男
            Assert.AreEqual("Tony Qu", response.Nickname);
            Assert.AreEqual("浦东新区", response.City);
            Assert.AreEqual("上海", response.Province);
            Assert.AreEqual("中国", response.Country);
            Assert.AreEqual("zh_CN", response.Language);
            Assert.IsTrue(response.HeadImgUrl.StartsWith("http://wx.qlogo.cn/"));
        }
コード例 #2
0
        public void TestUpdateUserRemark()
        {
            string openid            = GetOpenId();
            IUpdateUserRemarkApi api = new UpdateUserRemarkApi(context);
            var json = new UpdateUserRemarkJsonDataContainer();

            json.OpenId  = openid;
            json.Remark  = "Test1";
            api.JsonData = json;
            api.Execute();

            IGetUserInfoApi api2 = new GetUserInfoApi(context);

            api2.OpenId = openid;
            var result = api2.Execute();

            Assert.AreEqual("Test1", result.Remark);
        }