Browse Source

Remove ConfigureAwait(false) usages.

pull/3732/head
Halil İbrahim Kalkan 7 years ago
parent
commit
eb068bfff8
  1. 34
      modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserManager.cs
  2. 20
      modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/Organizations/OrganizationUnitManager.cs
  3. 8
      modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityUserRepository.cs
  4. 10
      modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreOrganizationUnitRepository.cs
  5. 14
      modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityUserRepository.cs
  6. 8
      modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoOrganizationUnitRepository.cs
  7. 20
      modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityUserManager_Tests.cs
  8. 36
      modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/OrganizationUnitManager_Tests.cs
  9. 26
      modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/AbpIdentityTestDataBuilder.cs
  10. 6
      modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityUserRepository_Tests.cs
  11. 6
      modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/LazyLoading_Tests.cs
  12. 14
      modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/OrganizationUnitRepository_Tests.cs

34
modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserManager.cs

@ -101,8 +101,8 @@ namespace Volo.Abp.Identity
public virtual async Task<bool> IsInOrganizationUnitAsync(Guid userId, Guid ouId) public virtual async Task<bool> IsInOrganizationUnitAsync(Guid userId, Guid ouId)
{ {
return await IsInOrganizationUnitAsync( return await IsInOrganizationUnitAsync(
await GetByIdAsync(userId).ConfigureAwait(false), await GetByIdAsync(userId),
await OrganizationUnitRepository.GetAsync(ouId).ConfigureAwait(false) await OrganizationUnitRepository.GetAsync(ouId)
); );
} }
@ -114,14 +114,14 @@ namespace Volo.Abp.Identity
public virtual async Task AddToOrganizationUnitAsync(Guid userId, Guid ouId) public virtual async Task AddToOrganizationUnitAsync(Guid userId, Guid ouId)
{ {
await AddToOrganizationUnitAsync( await AddToOrganizationUnitAsync(
await IdentityUserRepository.GetAsync(userId, true).ConfigureAwait(false), await IdentityUserRepository.GetAsync(userId, true),
await OrganizationUnitRepository.GetAsync(ouId).ConfigureAwait(false) await OrganizationUnitRepository.GetAsync(ouId)
); );
} }
public virtual async Task AddToOrganizationUnitAsync(IdentityUser user, OrganizationUnit ou) public virtual async Task AddToOrganizationUnitAsync(IdentityUser user, OrganizationUnit ou)
{ {
await IdentityUserRepository.EnsureCollectionLoadedAsync(user, u => u.OrganizationUnits, CancellationTokenProvider.Token).ConfigureAwait(false); await IdentityUserRepository.EnsureCollectionLoadedAsync(user, u => u.OrganizationUnits, CancellationTokenProvider.Token);
var currentOus = user.OrganizationUnits; var currentOus = user.OrganizationUnits;
@ -138,14 +138,14 @@ namespace Volo.Abp.Identity
public virtual async Task RemoveFromOrganizationUnitAsync(Guid userId, Guid ouId) public virtual async Task RemoveFromOrganizationUnitAsync(Guid userId, Guid ouId)
{ {
await RemoveFromOrganizationUnitAsync( await RemoveFromOrganizationUnitAsync(
await IdentityUserRepository.GetAsync(userId, true).ConfigureAwait(false), await IdentityUserRepository.GetAsync(userId, true),
await OrganizationUnitRepository.GetAsync(ouId).ConfigureAwait(false) await OrganizationUnitRepository.GetAsync(ouId)
); );
} }
public virtual async Task RemoveFromOrganizationUnitAsync(IdentityUser user, OrganizationUnit ou) public virtual async Task RemoveFromOrganizationUnitAsync(IdentityUser user, OrganizationUnit ou)
{ {
await IdentityUserRepository.EnsureCollectionLoadedAsync(user, u => u.OrganizationUnits, CancellationTokenProvider.Token).ConfigureAwait(false); await IdentityUserRepository.EnsureCollectionLoadedAsync(user, u => u.OrganizationUnits, CancellationTokenProvider.Token);
user.RemoveOrganizationUnit(ou.Id); user.RemoveOrganizationUnit(ou.Id);
} }
@ -153,7 +153,7 @@ namespace Volo.Abp.Identity
public virtual async Task SetOrganizationUnitsAsync(Guid userId, params Guid[] organizationUnitIds) public virtual async Task SetOrganizationUnitsAsync(Guid userId, params Guid[] organizationUnitIds)
{ {
await SetOrganizationUnitsAsync( await SetOrganizationUnitsAsync(
await IdentityUserRepository.GetAsync(userId, true).ConfigureAwait(false), await IdentityUserRepository.GetAsync(userId, true),
organizationUnitIds organizationUnitIds
); );
} }
@ -165,14 +165,14 @@ namespace Volo.Abp.Identity
await CheckMaxUserOrganizationUnitMembershipCountAsync(user.TenantId, organizationUnitIds.Length); await CheckMaxUserOrganizationUnitMembershipCountAsync(user.TenantId, organizationUnitIds.Length);
var currentOus = await IdentityUserRepository.GetOrganizationUnitsAsync(user.Id).ConfigureAwait(false); var currentOus = await IdentityUserRepository.GetOrganizationUnitsAsync(user.Id);
//Remove from removed OUs //Remove from removed OUs
foreach (var currentOu in currentOus) foreach (var currentOu in currentOus)
{ {
if (!organizationUnitIds.Contains(currentOu.Id)) if (!organizationUnitIds.Contains(currentOu.Id))
{ {
await RemoveFromOrganizationUnitAsync(user.Id, currentOu.Id).ConfigureAwait(false); await RemoveFromOrganizationUnitAsync(user.Id, currentOu.Id);
} }
} }
@ -183,7 +183,7 @@ namespace Volo.Abp.Identity
{ {
await AddToOrganizationUnitAsync( await AddToOrganizationUnitAsync(
user, user,
await OrganizationUnitRepository.GetAsync(organizationUnitId).ConfigureAwait(false) await OrganizationUnitRepository.GetAsync(organizationUnitId)
); );
} }
} }
@ -191,7 +191,7 @@ namespace Volo.Abp.Identity
private async Task CheckMaxUserOrganizationUnitMembershipCountAsync(Guid? tenantId, int requestedCount) private async Task CheckMaxUserOrganizationUnitMembershipCountAsync(Guid? tenantId, int requestedCount)
{ {
var maxCount = await SettingProvider.GetAsync<int>(IdentitySettingNames.OrganizationUnit.MaxUserMembershipCount).ConfigureAwait(false); var maxCount = await SettingProvider.GetAsync<int>(IdentitySettingNames.OrganizationUnit.MaxUserMembershipCount);
if (requestedCount > maxCount) if (requestedCount > maxCount)
{ {
throw new AbpException(string.Format("Can not set more than {0} organization unit for a user!", maxCount)); throw new AbpException(string.Format("Can not set more than {0} organization unit for a user!", maxCount));
@ -201,11 +201,11 @@ namespace Volo.Abp.Identity
[UnitOfWork] [UnitOfWork]
public virtual async Task<List<OrganizationUnit>> GetOrganizationUnitsAsync(IdentityUser user) public virtual async Task<List<OrganizationUnit>> GetOrganizationUnitsAsync(IdentityUser user)
{ {
await IdentityUserRepository.EnsureCollectionLoadedAsync(user, u => u.OrganizationUnits, CancellationTokenProvider.Token).ConfigureAwait(false); await IdentityUserRepository.EnsureCollectionLoadedAsync(user, u => u.OrganizationUnits, CancellationTokenProvider.Token);
var ouOfUser = user.OrganizationUnits; var ouOfUser = user.OrganizationUnits;
return await OrganizationUnitRepository.GetListAsync(ouOfUser.Select(t => t.OrganizationUnitId)).ConfigureAwait(false); return await OrganizationUnitRepository.GetListAsync(ouOfUser.Select(t => t.OrganizationUnitId));
} }
[UnitOfWork] [UnitOfWork]
@ -216,13 +216,13 @@ namespace Volo.Abp.Identity
{ {
return await IdentityUserRepository return await IdentityUserRepository
.GetUsersInOrganizationUnitWithChildrenAsync(organizationUnit.Code) .GetUsersInOrganizationUnitWithChildrenAsync(organizationUnit.Code)
.ConfigureAwait(false); ;
} }
else else
{ {
return await IdentityUserRepository return await IdentityUserRepository
.GetUsersInOrganizationUnitAsync(organizationUnit.Id) .GetUsersInOrganizationUnitAsync(organizationUnit.Id)
.ConfigureAwait(false); ;
} }
} }

20
modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/Organizations/OrganizationUnitManager.cs

@ -40,13 +40,13 @@ namespace Volo.Abp.Identity.Organizations
{ {
organizationUnit.Code = await GetNextChildCodeAsync(organizationUnit.ParentId); organizationUnit.Code = await GetNextChildCodeAsync(organizationUnit.ParentId);
await ValidateOrganizationUnitAsync(organizationUnit); await ValidateOrganizationUnitAsync(organizationUnit);
await _organizationUnitRepository.InsertAsync(organizationUnit).ConfigureAwait(false); await _organizationUnitRepository.InsertAsync(organizationUnit);
} }
public virtual async Task UpdateAsync(OrganizationUnit organizationUnit) public virtual async Task UpdateAsync(OrganizationUnit organizationUnit)
{ {
await ValidateOrganizationUnitAsync(organizationUnit); await ValidateOrganizationUnitAsync(organizationUnit);
await _organizationUnitRepository.UpdateAsync(organizationUnit).ConfigureAwait(false); await _organizationUnitRepository.UpdateAsync(organizationUnit);
} }
public virtual async Task<string> GetNextChildCodeAsync(Guid? parentId) public virtual async Task<string> GetNextChildCodeAsync(Guid? parentId)
@ -74,16 +74,16 @@ namespace Volo.Abp.Identity.Organizations
foreach (var child in children) foreach (var child in children)
{ {
await _organizationUnitRepository.DeleteAsync(child).ConfigureAwait(false); await _organizationUnitRepository.DeleteAsync(child);
} }
await _organizationUnitRepository.DeleteAsync(id).ConfigureAwait(false); await _organizationUnitRepository.DeleteAsync(id);
} }
[UnitOfWork] [UnitOfWork]
public virtual async Task MoveAsync(Guid id, Guid? parentId) public virtual async Task MoveAsync(Guid id, Guid? parentId)
{ {
var organizationUnit = await _organizationUnitRepository.GetAsync(id).ConfigureAwait(false); var organizationUnit = await _organizationUnitRepository.GetAsync(id);
if (organizationUnit.ParentId == parentId) if (organizationUnit.ParentId == parentId)
{ {
return; return;
@ -110,7 +110,7 @@ namespace Volo.Abp.Identity.Organizations
public virtual async Task<string> GetCodeOrDefaultAsync(Guid id) public virtual async Task<string> GetCodeOrDefaultAsync(Guid id)
{ {
var ou = await _organizationUnitRepository.GetAsync(id).ConfigureAwait(false); var ou = await _organizationUnitRepository.GetAsync(id);
return ou?.Code; return ou?.Code;
} }
@ -130,12 +130,12 @@ namespace Volo.Abp.Identity.Organizations
{ {
if (!recursive) if (!recursive)
{ {
return await _organizationUnitRepository.GetChildrenAsync(parentId).ConfigureAwait(false); return await _organizationUnitRepository.GetChildrenAsync(parentId);
} }
if (!parentId.HasValue) if (!parentId.HasValue)
{ {
return await _organizationUnitRepository.GetListAsync().ConfigureAwait(false); return await _organizationUnitRepository.GetListAsync();
} }
var code = await GetCodeOrDefaultAsync(parentId.Value); var code = await GetCodeOrDefaultAsync(parentId.Value);
@ -151,8 +151,8 @@ namespace Volo.Abp.Identity.Organizations
public virtual async Task AddRoleToOrganizationUnitAsync(Guid roleId, Guid ouId) public virtual async Task AddRoleToOrganizationUnitAsync(Guid roleId, Guid ouId)
{ {
await AddRoleToOrganizationUnitAsync( await AddRoleToOrganizationUnitAsync(
await _identityRoleRepository.GetAsync(roleId).ConfigureAwait(false), await _identityRoleRepository.GetAsync(roleId),
await _organizationUnitRepository.GetAsync(ouId, true).ConfigureAwait(false) await _organizationUnitRepository.GetAsync(ouId, true)
); );
} }

8
modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityUserRepository.cs

@ -54,7 +54,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore
where userOu.UserId == id where userOu.UserId == id
select userOuRoles.Name; select userOuRoles.Name;
return await query.ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); return await query.ToListAsync(GetCancellationToken(cancellationToken));
} }
public virtual async Task<IdentityUser> FindByLoginAsync( public virtual async Task<IdentityUser> FindByLoginAsync(
@ -167,7 +167,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore
where userOU.UserId == id where userOU.UserId == id
select ou; select ou;
return await query.ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); return await query.ToListAsync(GetCancellationToken(cancellationToken));
} }
public virtual async Task<List<IdentityUser>> GetUsersInOrganizationUnitAsync( public virtual async Task<List<IdentityUser>> GetUsersInOrganizationUnitAsync(
@ -179,7 +179,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore
join user in DbSet on userOu.UserId equals user.Id join user in DbSet on userOu.UserId equals user.Id
where userOu.OrganizationUnitId == organizationUnitId where userOu.OrganizationUnitId == organizationUnitId
select user; select user;
return await query.ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); return await query.ToListAsync(GetCancellationToken(cancellationToken));
} }
@ -193,7 +193,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore
join ou in DbContext.Set<OrganizationUnit>() on userOu.OrganizationUnitId equals ou.Id join ou in DbContext.Set<OrganizationUnit>() on userOu.OrganizationUnitId equals ou.Id
where ou.Code.StartsWith(code) where ou.Code.StartsWith(code)
select user; select user;
return await query.ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); return await query.ToListAsync(GetCancellationToken(cancellationToken));
} }
public override IQueryable<IdentityUser> WithDetails() public override IQueryable<IdentityUser> WithDetails()

10
modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreOrganizationUnitRepository.cs

@ -21,25 +21,25 @@ namespace Volo.Abp.Identity.EntityFrameworkCore
public async Task<List<OrganizationUnit>> GetChildrenAsync(Guid? parentId, CancellationToken cancellationToken = default) public async Task<List<OrganizationUnit>> GetChildrenAsync(Guid? parentId, CancellationToken cancellationToken = default)
{ {
return await DbSet.Where(x => x.ParentId == parentId) return await DbSet.Where(x => x.ParentId == parentId)
.ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); .ToListAsync(GetCancellationToken(cancellationToken));
} }
public async Task<List<OrganizationUnit>> GetAllChildrenWithParentCodeAsync(string code, Guid? parentId, CancellationToken cancellationToken = default) public async Task<List<OrganizationUnit>> GetAllChildrenWithParentCodeAsync(string code, Guid? parentId, CancellationToken cancellationToken = default)
{ {
return await DbSet.Where(ou => ou.Code.StartsWith(code) && ou.Id != parentId.Value) return await DbSet.Where(ou => ou.Code.StartsWith(code) && ou.Id != parentId.Value)
.ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); .ToListAsync(GetCancellationToken(cancellationToken));
} }
public async Task<List<OrganizationUnit>> GetListAsync(IEnumerable<Guid> ids, CancellationToken cancellationToken = default) public async Task<List<OrganizationUnit>> GetListAsync(IEnumerable<Guid> ids, CancellationToken cancellationToken = default)
{ {
return await DbSet.Where(t => ids.Contains(t.Id)).ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); return await DbSet.Where(t => ids.Contains(t.Id)).ToListAsync(GetCancellationToken(cancellationToken));
} }
public override async Task<List<OrganizationUnit>> GetListAsync(bool includeDetails = true, CancellationToken cancellationToken = default) public override async Task<List<OrganizationUnit>> GetListAsync(bool includeDetails = true, CancellationToken cancellationToken = default)
{ {
return await DbSet return await DbSet
.IncludeDetails(includeDetails) .IncludeDetails(includeDetails)
.ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); .ToListAsync(GetCancellationToken(cancellationToken));
} }
public async Task<OrganizationUnit> GetOrganizationUnitAsync(string displayName, bool includeDetails = false, CancellationToken cancellationToken = default) public async Task<OrganizationUnit> GetOrganizationUnitAsync(string displayName, bool includeDetails = false, CancellationToken cancellationToken = default)
@ -49,7 +49,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore
.FirstOrDefaultAsync( .FirstOrDefaultAsync(
ou => ou.DisplayName == displayName, ou => ou.DisplayName == displayName,
GetCancellationToken(cancellationToken) GetCancellationToken(cancellationToken)
).ConfigureAwait(false); );
} }
public override IQueryable<OrganizationUnit> WithDetails() public override IQueryable<OrganizationUnit> WithDetails()

14
modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityUserRepository.cs

@ -48,11 +48,11 @@ namespace Volo.Abp.Identity.MongoDB
Guid id, Guid id,
CancellationToken cancellationToken = default) CancellationToken cancellationToken = default)
{ {
var user = await GetAsync(id, cancellationToken: GetCancellationToken(cancellationToken)).ConfigureAwait(false); var user = await GetAsync(id, cancellationToken: GetCancellationToken(cancellationToken));
var organizationUnitIds = user.OrganizationUnits.Select(r => r.OrganizationUnitId); var organizationUnitIds = user.OrganizationUnits.Select(r => r.OrganizationUnitId);
var organizationUnits = DbContext.OrganizationUnits.AsQueryable().Where(ou => organizationUnitIds.Contains(ou.Id)); var organizationUnits = DbContext.OrganizationUnits.AsQueryable().Where(ou => organizationUnitIds.Contains(ou.Id));
var roleIds = organizationUnits.SelectMany(x => x.Roles.Select(r => r.RoleId)); var roleIds = organizationUnits.SelectMany(x => x.Roles.Select(r => r.RoleId));
return await DbContext.Roles.AsQueryable().Where(r => roleIds.Contains(r.Id)).Select(r => r.Name).ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); return await DbContext.Roles.AsQueryable().Where(r => roleIds.Contains(r.Id)).Select(r => r.Name).ToListAsync(GetCancellationToken(cancellationToken));
} }
public virtual async Task<IdentityUser> FindByLoginAsync( public virtual async Task<IdentityUser> FindByLoginAsync(
@ -137,12 +137,12 @@ namespace Volo.Abp.Identity.MongoDB
bool includeDetails = false, bool includeDetails = false,
CancellationToken cancellationToken = default) CancellationToken cancellationToken = default)
{ {
var user = await GetAsync(id, cancellationToken: GetCancellationToken(cancellationToken)).ConfigureAwait(false); var user = await GetAsync(id, cancellationToken: GetCancellationToken(cancellationToken));
var organizationUnitIds = user.OrganizationUnits.Select(r => r.OrganizationUnitId); var organizationUnitIds = user.OrganizationUnits.Select(r => r.OrganizationUnitId);
return await DbContext.OrganizationUnits.AsQueryable() return await DbContext.OrganizationUnits.AsQueryable()
.Where(ou => organizationUnitIds.Contains(ou.Id)) .Where(ou => organizationUnitIds.Contains(ou.Id))
.ToListAsync(GetCancellationToken(cancellationToken)) .ToListAsync(GetCancellationToken(cancellationToken))
.ConfigureAwait(false); ;
} }
public virtual async Task<long> GetCountAsync( public virtual async Task<long> GetCountAsync(
@ -166,7 +166,7 @@ namespace Volo.Abp.Identity.MongoDB
var result = await GetMongoQueryable() var result = await GetMongoQueryable()
.Where(u => u.OrganizationUnits.Any(uou => uou.OrganizationUnitId == organizationUnitId)) .Where(u => u.OrganizationUnits.Any(uou => uou.OrganizationUnitId == organizationUnitId))
.ToListAsync(GetCancellationToken(cancellationToken)) .ToListAsync(GetCancellationToken(cancellationToken))
.ConfigureAwait(false); ;
return result; return result;
} }
@ -178,12 +178,12 @@ namespace Volo.Abp.Identity.MongoDB
.Where(ou => ou.Code.StartsWith(code)) .Where(ou => ou.Code.StartsWith(code))
.Select(ou => ou.Id) .Select(ou => ou.Id)
.ToListAsync(GetCancellationToken(cancellationToken)) .ToListAsync(GetCancellationToken(cancellationToken))
.ConfigureAwait(false); ;
return await GetMongoQueryable() return await GetMongoQueryable()
.Where(u => u.OrganizationUnits.Any(uou => organizationUnitIds.Contains(uou.OrganizationUnitId))) .Where(u => u.OrganizationUnits.Any(uou => organizationUnitIds.Contains(uou.OrganizationUnitId)))
.ToListAsync(GetCancellationToken(cancellationToken)) .ToListAsync(GetCancellationToken(cancellationToken))
.ConfigureAwait(false); ;
} }
} }
} }

8
modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoOrganizationUnitRepository.cs

@ -28,20 +28,20 @@ namespace Volo.Abp.Identity.MongoDB
public async Task<List<OrganizationUnit>> GetChildrenAsync(Guid? parentId, CancellationToken cancellationToken = default) public async Task<List<OrganizationUnit>> GetChildrenAsync(Guid? parentId, CancellationToken cancellationToken = default)
{ {
return await DbContext.OrganizationUnits.AsQueryable().Where(ou => ou.ParentId == parentId) return await DbContext.OrganizationUnits.AsQueryable().Where(ou => ou.ParentId == parentId)
.ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); .ToListAsync(GetCancellationToken(cancellationToken));
} }
public async Task<List<OrganizationUnit>> GetAllChildrenWithParentCodeAsync(string code, Guid? parentId, CancellationToken cancellationToken = default) public async Task<List<OrganizationUnit>> GetAllChildrenWithParentCodeAsync(string code, Guid? parentId, CancellationToken cancellationToken = default)
{ {
return await DbContext.OrganizationUnits.AsQueryable() return await DbContext.OrganizationUnits.AsQueryable()
.Where(ou => ou.Code.StartsWith(code) && ou.Id != parentId.Value) .Where(ou => ou.Code.StartsWith(code) && ou.Id != parentId.Value)
.ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); .ToListAsync(GetCancellationToken(cancellationToken));
} }
public async Task<List<OrganizationUnit>> GetListAsync(IEnumerable<Guid> ids, CancellationToken cancellationToken = default) public async Task<List<OrganizationUnit>> GetListAsync(IEnumerable<Guid> ids, CancellationToken cancellationToken = default)
{ {
return await DbContext.OrganizationUnits.AsQueryable() return await DbContext.OrganizationUnits.AsQueryable()
.Where(t => ids.Contains(t.Id)).ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); .Where(t => ids.Contains(t.Id)).ToListAsync(GetCancellationToken(cancellationToken));
} }
public async Task<OrganizationUnit> GetOrganizationUnitAsync(string displayName, bool includeDetails = false, CancellationToken cancellationToken = default) public async Task<OrganizationUnit> GetOrganizationUnitAsync(string displayName, bool includeDetails = false, CancellationToken cancellationToken = default)
@ -50,7 +50,7 @@ namespace Volo.Abp.Identity.MongoDB
.FirstOrDefaultAsync( .FirstOrDefaultAsync(
ou => ou.DisplayName == displayName, ou => ou.DisplayName == displayName,
GetCancellationToken(cancellationToken) GetCancellationToken(cancellationToken)
).ConfigureAwait(false); );
} }
} }
} }

20
modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityUserManager_Tests.cs

@ -98,24 +98,24 @@ namespace Volo.Abp.Identity
using (var uow = _unitOfWorkManager.Begin()) using (var uow = _unitOfWorkManager.Begin())
{ {
var user = await _identityUserRepository.FindByNormalizedUserNameAsync( var user = await _identityUserRepository.FindByNormalizedUserNameAsync(
_lookupNormalizer.NormalizeName("david")).ConfigureAwait(false); _lookupNormalizer.NormalizeName("david"));
user.ShouldNotBeNull(); user.ShouldNotBeNull();
var ou = await _organizationUnitRepository.GetOrganizationUnitAsync( var ou = await _organizationUnitRepository.GetOrganizationUnitAsync(
_lookupNormalizer.NormalizeName("OU11")).ConfigureAwait(false); _lookupNormalizer.NormalizeName("OU11"));
ou.ShouldNotBeNull(); ou.ShouldNotBeNull();
await _identityUserManager.SetOrganizationUnitsAsync(user, new Guid[] await _identityUserManager.SetOrganizationUnitsAsync(user, new Guid[]
{ {
ou.Id ou.Id
}).ConfigureAwait(false); });
user = await _identityUserRepository.FindByNormalizedUserNameAsync( user = await _identityUserRepository.FindByNormalizedUserNameAsync(
_lookupNormalizer.NormalizeName("david")).ConfigureAwait(false); _lookupNormalizer.NormalizeName("david"));
user.OrganizationUnits.Count.ShouldBeGreaterThan(0); user.OrganizationUnits.Count.ShouldBeGreaterThan(0);
user.OrganizationUnits.FirstOrDefault(uou => uou.OrganizationUnitId == ou.Id).ShouldNotBeNull(); user.OrganizationUnits.FirstOrDefault(uou => uou.OrganizationUnitId == ou.Id).ShouldNotBeNull();
await uow.CompleteAsync().ConfigureAwait(false); await uow.CompleteAsync();
} }
@ -155,25 +155,25 @@ namespace Volo.Abp.Identity
using (var uow = _unitOfWorkManager.Begin()) using (var uow = _unitOfWorkManager.Begin())
{ {
var ou = await _organizationUnitRepository.GetOrganizationUnitAsync( var ou = await _organizationUnitRepository.GetOrganizationUnitAsync(
_lookupNormalizer.NormalizeName("OU111")).ConfigureAwait(false); _lookupNormalizer.NormalizeName("OU111"));
ou.ShouldNotBeNull(); ou.ShouldNotBeNull();
var user = await _identityUserRepository.FindByNormalizedUserNameAsync( var user = await _identityUserRepository.FindByNormalizedUserNameAsync(
_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); _lookupNormalizer.NormalizeName("john.nash"));
user.ShouldNotBeNull(); user.ShouldNotBeNull();
var ouNew = await _organizationUnitRepository.GetOrganizationUnitAsync( var ouNew = await _organizationUnitRepository.GetOrganizationUnitAsync(
_lookupNormalizer.NormalizeName("OU2")).ConfigureAwait(false); _lookupNormalizer.NormalizeName("OU2"));
ouNew.ShouldNotBeNull(); ouNew.ShouldNotBeNull();
await _identityUserManager.SetOrganizationUnitsAsync(user, new Guid[] await _identityUserManager.SetOrganizationUnitsAsync(user, new Guid[]
{ {
ouNew.Id ouNew.Id
}).ConfigureAwait(false); });
user.OrganizationUnits.ShouldNotContain(x => x.OrganizationUnitId == ou.Id); user.OrganizationUnits.ShouldNotContain(x => x.OrganizationUnitId == ou.Id);
await uow.CompleteAsync().ConfigureAwait(false); await uow.CompleteAsync();
} }
} }

36
modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/OrganizationUnitManager_Tests.cs

@ -31,55 +31,55 @@ namespace Volo.Abp.Identity
{ {
await _organizationUnitManager.CreateAsync(new OrganizationUnit(null, "Root 1")); await _organizationUnitManager.CreateAsync(new OrganizationUnit(null, "Root 1"));
var root1 = await _organizationUnitRepository.GetOrganizationUnitAsync("Root 1").ConfigureAwait(false); var root1 = await _organizationUnitRepository.GetOrganizationUnitAsync("Root 1");
root1.ShouldNotBeNull(); root1.ShouldNotBeNull();
} }
[Fact] [Fact]
public async Task UpdateAsync() public async Task UpdateAsync()
{ {
var ou = await _organizationUnitRepository.GetOrganizationUnitAsync("OU111").ConfigureAwait(false); var ou = await _organizationUnitRepository.GetOrganizationUnitAsync("OU111");
ou.Code = OrganizationUnit.CreateCode(123); ou.Code = OrganizationUnit.CreateCode(123);
await _organizationUnitManager.UpdateAsync(ou); await _organizationUnitManager.UpdateAsync(ou);
var ouAfterChange = await _organizationUnitRepository.GetOrganizationUnitAsync("OU111").ConfigureAwait(false); var ouAfterChange = await _organizationUnitRepository.GetOrganizationUnitAsync("OU111");
ouAfterChange.Code.ShouldContain("123"); ouAfterChange.Code.ShouldContain("123");
} }
[Fact] [Fact]
public async Task DeleteAsync() public async Task DeleteAsync()
{ {
var ou = await _organizationUnitRepository.GetOrganizationUnitAsync("OU11").ConfigureAwait(false); var ou = await _organizationUnitRepository.GetOrganizationUnitAsync("OU11");
await _organizationUnitManager.DeleteAsync(ou.Id); await _organizationUnitManager.DeleteAsync(ou.Id);
(await _organizationUnitRepository.GetOrganizationUnitAsync("OU11").ConfigureAwait(false)).ShouldBeNull(); (await _organizationUnitRepository.GetOrganizationUnitAsync("OU11")).ShouldBeNull();
} }
[Fact] [Fact]
public async Task MoveAsync() public async Task MoveAsync()
{ {
var ou1 = await _organizationUnitRepository.GetOrganizationUnitAsync("OU1").ConfigureAwait(false); var ou1 = await _organizationUnitRepository.GetOrganizationUnitAsync("OU1");
var ou2 = await _organizationUnitRepository.GetOrganizationUnitAsync("OU2").ConfigureAwait(false); var ou2 = await _organizationUnitRepository.GetOrganizationUnitAsync("OU2");
await _organizationUnitManager.MoveAsync(ou1.Id, ou2.Id); await _organizationUnitManager.MoveAsync(ou1.Id, ou2.Id);
ou1 = await _organizationUnitRepository.GetOrganizationUnitAsync("OU1").ConfigureAwait(false); ou1 = await _organizationUnitRepository.GetOrganizationUnitAsync("OU1");
ou1.ParentId.ShouldBe(ou2.Id); ou1.ParentId.ShouldBe(ou2.Id);
ou1.Code.ShouldBe(OrganizationUnit.CreateCode(2, 2)); ou1.Code.ShouldBe(OrganizationUnit.CreateCode(2, 2));
var ou11 = await _organizationUnitRepository.GetOrganizationUnitAsync("OU11").ConfigureAwait(false); var ou11 = await _organizationUnitRepository.GetOrganizationUnitAsync("OU11");
ou11.ParentId.ShouldBe(ou1.Id); ou11.ParentId.ShouldBe(ou1.Id);
ou11.Code.ShouldBe(OrganizationUnit.CreateCode(2, 2, 1)); ou11.Code.ShouldBe(OrganizationUnit.CreateCode(2, 2, 1));
var ou111 = await _organizationUnitRepository.GetOrganizationUnitAsync("OU111").ConfigureAwait(false); var ou111 = await _organizationUnitRepository.GetOrganizationUnitAsync("OU111");
ou111.ParentId.ShouldBe(ou11.Id); ou111.ParentId.ShouldBe(ou11.Id);
ou111.Code.ShouldBe(OrganizationUnit.CreateCode(2, 2, 1, 1)); ou111.Code.ShouldBe(OrganizationUnit.CreateCode(2, 2, 1, 1));
var ou112 = await _organizationUnitRepository.GetOrganizationUnitAsync("OU112").ConfigureAwait(false); var ou112 = await _organizationUnitRepository.GetOrganizationUnitAsync("OU112");
ou112.ParentId.ShouldBe(ou11.Id); ou112.ParentId.ShouldBe(ou11.Id);
ou112.Code.ShouldBe(OrganizationUnit.CreateCode(2, 2, 1, 2)); ou112.Code.ShouldBe(OrganizationUnit.CreateCode(2, 2, 1, 2));
var ou12 = await _organizationUnitRepository.GetOrganizationUnitAsync("OU12").ConfigureAwait(false); var ou12 = await _organizationUnitRepository.GetOrganizationUnitAsync("OU12");
ou12.ParentId.ShouldBe(ou1.Id); ou12.ParentId.ShouldBe(ou1.Id);
ou12.Code.ShouldBe(OrganizationUnit.CreateCode(2, 2, 2)); ou12.Code.ShouldBe(OrganizationUnit.CreateCode(2, 2, 2));
} }
@ -87,24 +87,24 @@ namespace Volo.Abp.Identity
[Fact] [Fact]
public async Task AddRoleToOrganizationUnitAsync() public async Task AddRoleToOrganizationUnitAsync()
{ {
var ou = await _organizationUnitRepository.GetOrganizationUnitAsync("OU1", true).ConfigureAwait(false); var ou = await _organizationUnitRepository.GetOrganizationUnitAsync("OU1", true);
var adminRole = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("admin")).ConfigureAwait(false); var adminRole = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("admin"));
await _organizationUnitManager.AddRoleToOrganizationUnitAsync(adminRole, ou); await _organizationUnitManager.AddRoleToOrganizationUnitAsync(adminRole, ou);
//TODO: This method has a bug: add role not work //TODO: This method has a bug: add role not work
ou = await _organizationUnitRepository.GetOrganizationUnitAsync("OU1", includeDetails: true).ConfigureAwait(false); ou = await _organizationUnitRepository.GetOrganizationUnitAsync("OU1", includeDetails: true);
ou.Roles.FirstOrDefault().RoleId.ShouldBe(adminRole.Id); ou.Roles.FirstOrDefault().RoleId.ShouldBe(adminRole.Id);
} }
[Fact] [Fact]
public async Task RemoveRoleFromOrganizationUnitAsync() public async Task RemoveRoleFromOrganizationUnitAsync()
{ {
var ou = await _organizationUnitRepository.GetOrganizationUnitAsync("OU1", true).ConfigureAwait(false); var ou = await _organizationUnitRepository.GetOrganizationUnitAsync("OU1", true);
var adminRole = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("admin")).ConfigureAwait(false); var adminRole = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("admin"));
await _organizationUnitManager.AddRoleToOrganizationUnitAsync(adminRole.Id, ou.Id); await _organizationUnitManager.AddRoleToOrganizationUnitAsync(adminRole.Id, ou.Id);
await _organizationUnitManager.RemoveRoleFromOrganizationUnitAsync(adminRole.Id, ou.Id); await _organizationUnitManager.RemoveRoleFromOrganizationUnitAsync(adminRole.Id, ou.Id);
ou = await _organizationUnitRepository.GetOrganizationUnitAsync("OU1", includeDetails: true).ConfigureAwait(false); ou = await _organizationUnitRepository.GetOrganizationUnitAsync("OU1", includeDetails: true);
ou.Roles.FirstOrDefault(r => r.RoleId == adminRole.Id).ShouldBeNull(); ou.Roles.FirstOrDefault(r => r.RoleId == adminRole.Id).ShouldBeNull();
} }
} }

26
modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/AbpIdentityTestDataBuilder.cs

@ -47,10 +47,10 @@ namespace Volo.Abp.Identity
public async Task Build() public async Task Build()
{ {
await AddRoles().ConfigureAwait(false); await AddRoles();
await AddOrganizationUnits().ConfigureAwait(false); await AddOrganizationUnits();
await AddUsers().ConfigureAwait(false); await AddUsers();
await AddClaimTypes().ConfigureAwait(false); await AddClaimTypes();
} }
private async Task AddRoles() private async Task AddRoles()
@ -77,17 +77,17 @@ namespace Volo.Abp.Identity
*/ */
private async Task AddOrganizationUnits() private async Task AddOrganizationUnits()
{ {
var ou1 = await CreateOU("OU1", OrganizationUnit.CreateCode(1)).ConfigureAwait(false); var ou1 = await CreateOU("OU1", OrganizationUnit.CreateCode(1));
var ou11 = await CreateOU("OU11", OrganizationUnit.CreateCode(1, 1), ou1.Id).ConfigureAwait(false); var ou11 = await CreateOU("OU11", OrganizationUnit.CreateCode(1, 1), ou1.Id);
_ou112 = await CreateOU("OU112", OrganizationUnit.CreateCode(1, 1, 2), ou11.Id).ConfigureAwait(false); _ou112 = await CreateOU("OU112", OrganizationUnit.CreateCode(1, 1, 2), ou11.Id);
var ou12 = await CreateOU("OU12", OrganizationUnit.CreateCode(1, 2), ou1.Id).ConfigureAwait(false); var ou12 = await CreateOU("OU12", OrganizationUnit.CreateCode(1, 2), ou1.Id);
var ou2 = await CreateOU("OU2", OrganizationUnit.CreateCode(2)).ConfigureAwait(false); var ou2 = await CreateOU("OU2", OrganizationUnit.CreateCode(2));
var ou21 = await CreateOU("OU21", OrganizationUnit.CreateCode(2, 1), ou2.Id).ConfigureAwait(false); var ou21 = await CreateOU("OU21", OrganizationUnit.CreateCode(2, 1), ou2.Id);
_ou111 = new OrganizationUnit(null, "OU111", ou11.Id); _ou111 = new OrganizationUnit(null, "OU111", ou11.Id);
_ou111.Code = OrganizationUnit.CreateCode(1, 1, 1); _ou111.Code = OrganizationUnit.CreateCode(1, 1, 1);
_ou111.AddRole(_moderator.Id); _ou111.AddRole(_moderator.Id);
await _organizationUnitRepository.InsertAsync(_ou111).ConfigureAwait(false); await _organizationUnitRepository.InsertAsync(_ou111);
} }
private async Task AddUsers() private async Task AddUsers()
@ -121,7 +121,7 @@ namespace Volo.Abp.Identity
private async Task AddClaimTypes() private async Task AddClaimTypes()
{ {
var ageClaim = new IdentityClaimType(_testData.AgeClaimId, "Age", false, false, null, null, null, IdentityClaimValueType.Int); var ageClaim = new IdentityClaimType(_testData.AgeClaimId, "Age", false, false, null, null, null, IdentityClaimValueType.Int);
await _identityClaimTypeRepository.InsertAsync(ageClaim).ConfigureAwait(false); await _identityClaimTypeRepository.InsertAsync(ageClaim);
var educationClaim = new IdentityClaimType(_testData.EducationClaimId, "Education", true, false, null, null, null); var educationClaim = new IdentityClaimType(_testData.EducationClaimId, "Education", true, false, null, null, null);
await _identityClaimTypeRepository.InsertAsync(educationClaim); await _identityClaimTypeRepository.InsertAsync(educationClaim);
@ -129,7 +129,7 @@ namespace Volo.Abp.Identity
private async Task<OrganizationUnit> CreateOU(string displayName, string code, Guid? parentId = null) private async Task<OrganizationUnit> CreateOU(string displayName, string code, Guid? parentId = null)
{ {
var ou = await _organizationUnitRepository.InsertAsync(new OrganizationUnit(null, displayName, parentId) { Code = code }).ConfigureAwait(false); var ou = await _organizationUnitRepository.InsertAsync(new OrganizationUnit(null, displayName, parentId) { Code = code });
return ou; return ou;
} }
} }

6
modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityUserRepository_Tests.cs

@ -134,7 +134,7 @@ namespace Volo.Abp.Identity
[Fact] [Fact]
public async Task GetUsersInOrganizationUnitAsync() public async Task GetUsersInOrganizationUnitAsync()
{ {
var users = await UserRepository.GetUsersInOrganizationUnitAsync((await GetOU("OU111").ConfigureAwait(false)).Id).ConfigureAwait(false); var users = await UserRepository.GetUsersInOrganizationUnitAsync((await GetOU("OU111")).Id);
users.ShouldNotBeNull(); users.ShouldNotBeNull();
users.Count.ShouldBeGreaterThan(0); users.Count.ShouldBeGreaterThan(0);
} }
@ -142,7 +142,7 @@ namespace Volo.Abp.Identity
[Fact] [Fact]
public async Task GetUsersInOrganizationUnitWithChildrenAsync() public async Task GetUsersInOrganizationUnitWithChildrenAsync()
{ {
var users = await UserRepository.GetUsersInOrganizationUnitWithChildrenAsync((await GetOU("OU111").ConfigureAwait(false)).Code).ConfigureAwait(false); var users = await UserRepository.GetUsersInOrganizationUnitWithChildrenAsync((await GetOU("OU111")).Code);
users.ShouldNotBeNull(); users.ShouldNotBeNull();
users.Count.ShouldBeGreaterThan(0); users.Count.ShouldBeGreaterThan(0);
} }
@ -170,7 +170,7 @@ namespace Volo.Abp.Identity
private async Task<OrganizationUnit> GetOU(string diplayName) private async Task<OrganizationUnit> GetOU(string diplayName)
{ {
var organizationUnit = await OrganizationUnitRepository.GetOrganizationUnitAsync(diplayName).ConfigureAwait(false); var organizationUnit = await OrganizationUnitRepository.GetOrganizationUnitAsync(diplayName);
organizationUnit.ShouldNotBeNull(); organizationUnit.ShouldNotBeNull();
return organizationUnit; return organizationUnit;
} }

6
modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/LazyLoading_Tests.cs

@ -61,7 +61,7 @@ namespace Volo.Abp.Identity
john.OrganizationUnits.ShouldNotBeNull(); john.OrganizationUnits.ShouldNotBeNull();
john.OrganizationUnits.Any().ShouldBeTrue(); john.OrganizationUnits.Any().ShouldBeTrue();
await uow.CompleteAsync().ConfigureAwait(false); await uow.CompleteAsync();
} }
} }
@ -70,11 +70,11 @@ namespace Volo.Abp.Identity
{ {
using (var uow = GetRequiredService<IUnitOfWorkManager>().Begin()) using (var uow = GetRequiredService<IUnitOfWorkManager>().Begin())
{ {
var ou = await OrganizationUnitRepository.GetOrganizationUnitAsync(LookupNormalizer.NormalizeName("OU111"), includeDetails: false).ConfigureAwait(false); var ou = await OrganizationUnitRepository.GetOrganizationUnitAsync(LookupNormalizer.NormalizeName("OU111"), includeDetails: false);
ou.Roles.ShouldNotBeNull(); //? ou.Roles.ShouldNotBeNull(); //?
ou.Roles.Any().ShouldBeTrue(); ou.Roles.Any().ShouldBeTrue();
await uow.CompleteAsync().ConfigureAwait(false); await uow.CompleteAsync();
} }
} }
} }

14
modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/OrganizationUnitRepository_Tests.cs

@ -32,21 +32,21 @@ namespace Volo.Abp.Identity
[Fact] [Fact]
public async Task GetChildrenAsync() public async Task GetChildrenAsync()
{ {
(await OrganizationUnitRepository.GetChildrenAsync(_testData.RoleModeratorId).ConfigureAwait(false)).ShouldNotBeNull(); (await OrganizationUnitRepository.GetChildrenAsync(_testData.RoleModeratorId)).ShouldNotBeNull();
} }
[Fact] [Fact]
public async Task GetAllChildrenWithParentCodeAsync() public async Task GetAllChildrenWithParentCodeAsync()
{ {
(await OrganizationUnitRepository.GetAllChildrenWithParentCodeAsync(OrganizationUnit.CreateCode(0), _guidGenerator.Create()).ConfigureAwait(false)).ShouldNotBeNull(); (await OrganizationUnitRepository.GetAllChildrenWithParentCodeAsync(OrganizationUnit.CreateCode(0), _guidGenerator.Create())).ShouldNotBeNull();
} }
[Fact] [Fact]
public async Task GetListAsync() public async Task GetListAsync()
{ {
var ouIds = (await OrganizationUnitRepository.GetListAsync().ConfigureAwait(false)) var ouIds = (await OrganizationUnitRepository.GetListAsync())
.Select(ou => ou.Id).Take(2); .Select(ou => ou.Id).Take(2);
var ous = await OrganizationUnitRepository.GetListAsync(ouIds).ConfigureAwait(false); var ous = await OrganizationUnitRepository.GetListAsync(ouIds);
ous.Count.ShouldBe(2); ous.Count.ShouldBe(2);
ous.ShouldContain(ou => ou.Id == ouIds.First()); ous.ShouldContain(ou => ou.Id == ouIds.First());
} }
@ -54,20 +54,20 @@ namespace Volo.Abp.Identity
[Fact] [Fact]
public async Task GetOrganizationUnitAsync() public async Task GetOrganizationUnitAsync()
{ {
var organizationUnit = await OrganizationUnitRepository.GetOrganizationUnitAsync("OU111").ConfigureAwait(false); var organizationUnit = await OrganizationUnitRepository.GetOrganizationUnitAsync("OU111");
organizationUnit.ShouldNotBeNull(); organizationUnit.ShouldNotBeNull();
} }
[Fact] [Fact]
public async Task GetCountAsync() public async Task GetCountAsync()
{ {
(await OrganizationUnitRepository.GetCountAsync().ConfigureAwait(false)).ShouldBeGreaterThan(0); (await OrganizationUnitRepository.GetCountAsync()).ShouldBeGreaterThan(0);
} }
[Fact] [Fact]
public async Task Should_Eager_Load_OrganizationUnit_Collections() public async Task Should_Eager_Load_OrganizationUnit_Collections()
{ {
var ou = (await OrganizationUnitRepository.GetListAsync(true).ConfigureAwait(false)) var ou = (await OrganizationUnitRepository.GetListAsync(true))
.FirstOrDefault(ou => ou.DisplayName == "OU111"); .FirstOrDefault(ou => ou.DisplayName == "OU111");
ou.Roles.ShouldNotBeNull(); ou.Roles.ShouldNotBeNull();
ou.Roles.Any().ShouldBeTrue(); ou.Roles.Any().ShouldBeTrue();

Loading…
Cancel
Save