2022-01-21 17:06:31 +08:00
|
|
|
|
using System.Linq;
|
2021-05-28 19:27:38 +08:00
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Xunit;
|
|
|
|
|
|
|
|
|
|
namespace SKIT.FlurlHttpClient.Wechat.Api.UnitTests
|
|
|
|
|
{
|
2022-01-21 16:57:42 +08:00
|
|
|
|
public class TestCase_ApiExecuteCgibinUserTests
|
2021-05-28 19:27:38 +08:00
|
|
|
|
{
|
2022-01-21 16:57:42 +08:00
|
|
|
|
[Fact(DisplayName = "测试用例:调用 API [GET] /cgi-bin/user/info")]
|
|
|
|
|
public async Task TestExecuteCgibinUserInfo()
|
2021-05-28 19:27:38 +08:00
|
|
|
|
{
|
|
|
|
|
var request = new Models.CgibinUserInfoRequest()
|
|
|
|
|
{
|
|
|
|
|
AccessToken = TestConfigs.WechatAccessToken,
|
|
|
|
|
OpenId = TestConfigs.WechatOpenId
|
|
|
|
|
};
|
|
|
|
|
var response = await TestClients.Instance.ExecuteCgibinUserInfoAsync(request);
|
|
|
|
|
|
|
|
|
|
Assert.NotEmpty(response.OpenId);
|
|
|
|
|
Assert.True(response.IsSubscribed);
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-21 16:57:42 +08:00
|
|
|
|
[Fact(DisplayName = "测试用例:调用 API [POST] /cgi-bin/user/info/batchget")]
|
|
|
|
|
public async Task TestExecuteCgibinUserInfoBatchGet()
|
2021-05-28 19:27:38 +08:00
|
|
|
|
{
|
|
|
|
|
var request = new Models.CgibinUserInfoBatchGetRequest()
|
|
|
|
|
{
|
|
|
|
|
AccessToken = TestConfigs.WechatAccessToken,
|
2022-01-21 17:06:31 +08:00
|
|
|
|
UserList = new Models.CgibinUserInfoBatchGetRequest.Types.User[]
|
|
|
|
|
{
|
2021-05-28 19:27:38 +08:00
|
|
|
|
new Models.CgibinUserInfoBatchGetRequest.Types.User() { OpenId = TestConfigs.WechatOpenId }
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
var response = await TestClients.Instance.ExecuteCgibinUserInfoBatchGetAsync(request);
|
|
|
|
|
|
|
|
|
|
Assert.NotEmpty(response.UserList);
|
|
|
|
|
Assert.NotEmpty(response.UserList.First().OpenId);
|
|
|
|
|
Assert.True(response.UserList.First().IsSubscribed);
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-21 16:57:42 +08:00
|
|
|
|
[Fact(DisplayName = "测试用例:调用 API [POST] /cgi-bin/user/info/updateremark")]
|
|
|
|
|
public async Task TestExecuteCgibinUserInfoUpdateRemark()
|
2021-05-28 19:27:38 +08:00
|
|
|
|
{
|
|
|
|
|
var request = new Models.CgibinUserInfoUpdateRemarkRequest()
|
|
|
|
|
{
|
|
|
|
|
AccessToken = TestConfigs.WechatAccessToken,
|
|
|
|
|
OpenId = TestConfigs.WechatOpenId,
|
|
|
|
|
Remark = "FAKE_REMARK"
|
|
|
|
|
};
|
|
|
|
|
var response = await TestClients.Instance.ExecuteCgibinUserInfoUpdateRemarkAsync(request);
|
|
|
|
|
|
|
|
|
|
Assert.Equal(0, response.ErrorCode);
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-21 16:57:42 +08:00
|
|
|
|
[Fact(DisplayName = "测试用例:调用 API [GET] /cgi-bin/user/get")]
|
|
|
|
|
public async Task TestExecuteCgibinUserGet()
|
2021-05-28 19:27:38 +08:00
|
|
|
|
{
|
2021-06-09 17:32:50 +08:00
|
|
|
|
var request = new Models.CgibinUserGetRequest()
|
2021-05-28 19:27:38 +08:00
|
|
|
|
{
|
|
|
|
|
AccessToken = TestConfigs.WechatAccessToken
|
|
|
|
|
};
|
2021-06-09 17:32:50 +08:00
|
|
|
|
var response = await TestClients.Instance.ExecuteCgibinUserGetAsync(request);
|
2021-05-28 19:27:38 +08:00
|
|
|
|
|
|
|
|
|
Assert.NotEmpty(response.Data.OpenIdList);
|
|
|
|
|
Assert.True(response.Total > 0);
|
|
|
|
|
Assert.True(response.Count > 0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|