mirror of
https://github.com/BeyondDimension/SteamTools.git
synced 2026-10-24 02:39:46 +08:00
add new web api and test
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using NUnit.Framework;
|
||||
using System.Application.Models;
|
||||
using System.Application.Services;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
@@ -9,6 +10,9 @@ namespace System.Application
|
||||
[TestFixture]
|
||||
public class HttpTest
|
||||
{
|
||||
/// <summary>
|
||||
/// 测试图片下载缓存,同一个图片地址,多次请求,仅发送一次,且优先从缓存中加载图片
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void GetImage()
|
||||
{
|
||||
@@ -39,5 +43,47 @@ namespace System.Application
|
||||
TestContext.WriteLine($"({tid}-{tid2})requestUri: {requestUri}, length: {result?.Length}");
|
||||
}
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
|
||||
/// <summary>
|
||||
/// 测试 登陆与注册 接口,先开服务端(私有),再测试
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[Test]
|
||||
public async Task LoginOrRegister()
|
||||
{
|
||||
var client = ICloudServiceClient.Instance;
|
||||
|
||||
var req1 = new SendSmsRequest
|
||||
{
|
||||
PhoneNumber = "18611112222",
|
||||
Type = SmsCodeType.LoginOrRegister,
|
||||
};
|
||||
|
||||
var rsp1 = await client.AuthMessage.SendSms(req1);
|
||||
|
||||
Assert.IsTrue(rsp1.IsSuccess);
|
||||
|
||||
var req2 = new LoginOrRegisterRequest
|
||||
{
|
||||
PhoneNumber = req1.PhoneNumber,
|
||||
SmsCode = "666666",
|
||||
};
|
||||
var rsp2 = await ICloudServiceClient.Instance.Account.LoginOrRegister(req2);
|
||||
|
||||
Assert.IsTrue(rsp2.IsSuccess);
|
||||
|
||||
var isLoginOrRegister = rsp2.Content.ThrowIsNull(nameof(rsp2.Content)).IsLoginOrRegister;
|
||||
|
||||
TestContext.WriteLine($"isLoginOrRegister: {isLoginOrRegister}");
|
||||
|
||||
var jsonStr = Serializable2.S(rsp2.Content);
|
||||
|
||||
TestContext.WriteLine("jsonStr: ");
|
||||
TestContext.WriteLine(jsonStr);
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user