Skip to content

Commit cd8cdfa

Browse files
committed
Fix unit test: CreateUser_Test
1 parent 600b868 commit cd8cdfa

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

aspnet-core/src/AbpCompanyName.AbpProjectName.Application/Users/Dto/CreateUserDto.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
using Abp.Auditing;
33
using Abp.Authorization.Users;
44
using Abp.AutoMapper;
5+
using Abp.Runtime.Validation;
56
using AbpCompanyName.AbpProjectName.Authorization.Users;
67

78
namespace AbpCompanyName.AbpProjectName.Users.Dto
89
{
910
[AutoMapTo(typeof(User))]
10-
public class CreateUserDto
11+
public class CreateUserDto : IShouldNormalize
1112
{
1213
[Required]
1314
[StringLength(AbpUserBase.MaxUserNameLength)]
@@ -34,5 +35,13 @@ public class CreateUserDto
3435
[StringLength(AbpUserBase.MaxPlainPasswordLength)]
3536
[DisableAuditing]
3637
public string Password { get; set; }
38+
39+
public void Normalize()
40+
{
41+
if (RoleNames == null)
42+
{
43+
RoleNames = new string[0];
44+
}
45+
}
3746
}
3847
}

aspnet-core/src/AbpCompanyName.AbpProjectName.Application/Users/UserAppService.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using Microsoft.AspNetCore.Identity;
1010
using System.Linq;
1111
using Abp.Authorization;
12+
using Abp.Authorization.Users;
1213
using Microsoft.EntityFrameworkCore;
1314
using Abp.IdentityFramework;
1415
using AbpCompanyName.AbpProjectName.Authorization.Roles;

0 commit comments

Comments
 (0)