|
|
|
@ -11,11 +11,14 @@ namespace Volo.Abp.Identity |
|
|
|
{ |
|
|
|
private readonly IIdentityRoleAppService _roleAppService; |
|
|
|
private readonly IIdentityRoleRepository _roleRepository; |
|
|
|
|
|
|
|
private readonly IOrganizationUnitRepository _organizationUnitRepository; |
|
|
|
private readonly OrganizationUnitManager _organization; |
|
|
|
public IdentityRoleAppService_Tests() |
|
|
|
{ |
|
|
|
_roleAppService = GetRequiredService<IIdentityRoleAppService>(); |
|
|
|
_roleRepository = GetRequiredService<IIdentityRoleRepository>(); |
|
|
|
_organization = GetRequiredService<OrganizationUnitManager>(); |
|
|
|
_organizationUnitRepository=GetRequiredService<IOrganizationUnitRepository>(); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
@ -81,6 +84,32 @@ namespace Volo.Abp.Identity |
|
|
|
role.Name.ShouldBe(input.Name); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public async Task CreateWithDetailsAsync() |
|
|
|
{ |
|
|
|
//Arrange
|
|
|
|
var input = new IdentityRoleCreateDto |
|
|
|
{ |
|
|
|
Name = Guid.NewGuid().ToString("N").Left(8) |
|
|
|
}; |
|
|
|
|
|
|
|
var orgInput=new OrganizationUnit( |
|
|
|
_organization.GuidGenerator.Create(), |
|
|
|
Guid.NewGuid().ToString("N").Left(8) |
|
|
|
); |
|
|
|
|
|
|
|
//Act
|
|
|
|
var result = await _roleAppService.CreateAsync(input); |
|
|
|
|
|
|
|
await _organization.CreateAsync(orgInput); |
|
|
|
|
|
|
|
await _organization.AddRoleToOrganizationUnitAsync(result.Id,orgInput.Id); |
|
|
|
|
|
|
|
var orgRolesCount=await _organizationUnitRepository.GetRolesCountAsync(orgInput); |
|
|
|
//Assert
|
|
|
|
orgRolesCount.ShouldBeGreaterThan(0); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public async Task UpdateAsync() |
|
|
|
{ |
|
|
|
|