test: 完善单元测试

This commit is contained in:
陈淳
2024-04-29 17:50:51 +08:00
parent 32aca8c6a8
commit 29ee0b5945
16 changed files with 509 additions and 28 deletions

View File

@@ -103,14 +103,14 @@ namespace Yi.Framework.Rbac.Domain.Managers
if (userEntity.EncryPassword?.Password.Length < 6)
{
throw new UserFriendlyException("密码需大于等于6位");
throw new UserFriendlyException(UserConst.Create_Passworld_Error);
}
if (userEntity.Phone is not null)
{
if (await _repository.IsAnyAsync(x => x.Phone == userEntity.Phone))
{
throw new UserFriendlyException("用户手机号已重复");
throw new UserFriendlyException(UserConst.Phone_Repeat);
}
}
@@ -118,7 +118,7 @@ namespace Yi.Framework.Rbac.Domain.Managers
var isExist = await _repository.IsAnyAsync(x => x.UserName == userEntity.UserName);
if (isExist)
{
throw new UserFriendlyException("用户已存在,创建失败");
throw new UserFriendlyException(UserConst.User_Exist);
}
var entity = await _repository.InsertReturnEntityAsync(userEntity);