diff --git a/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityRoleAppService_Tests.cs b/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityRoleAppService_Tests.cs index 5d64bb6c78..0126758eb8 100644 --- a/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityRoleAppService_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityRoleAppService_Tests.cs @@ -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(); _roleRepository = GetRequiredService(); + _organization = GetRequiredService(); + _organizationUnitRepository=GetRequiredService(); } [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() {