sync with OpenAuth.Core

This commit is contained in:
yubaolee
2020-12-27 00:00:28 +08:00
parent 368eae8d63
commit 20a717b2e6
19 changed files with 451 additions and 199 deletions

View File

@@ -17,7 +17,7 @@ namespace OpenAuth.App.Test
var services = new ServiceCollection();
var cachemock = new Mock<ICacheContext>();
cachemock.Setup(x => x.Get<UserAuthSession>("tokentest")).Returns(new UserAuthSession { Account = "System" });
cachemock.Setup(x => x.Get<UserAuthSession>("tokentest")).Returns(new UserAuthSession { Account = Define.SYSTEM_USERNAME});
services.AddScoped(x => cachemock.Object);
var httpContextAccessorMock = new Mock<IHttpContextAccessor>();
@@ -28,6 +28,27 @@ namespace OpenAuth.App.Test
return services;
}
/// <summary>
/// 测试添加用户时,数据校验。
/// 因为请求数据没有AccountName等该测试会提示异常
/// </summary>
[Test]
public void TestValidation()
{
var app = _autofacServiceProvider.GetService<UserManagerApp>();
try
{
app.AddOrUpdate(new UpdateUserReq
{
OrganizationIds = "08f41bf6-4388-4b1e-bd3e-2ff538b44b1b",
});
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
[Test]
public void TestAdd()
{