Esempio n. 1
0
        public async Task RemoveRoleFromOrganizationUnitAsync()
        {
            var ou = await _organizationUnitRepository.GetAsync("OU1", true);

            var adminRole = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("admin"));

            await _organizationUnitManager.AddRoleToOrganizationUnitAsync(adminRole.Id, ou.Id);

            await _organizationUnitManager.RemoveRoleFromOrganizationUnitAsync(adminRole.Id, ou.Id);

            ou = await _organizationUnitRepository.GetAsync("OU1", includeDetails : true);

            ou.Roles.FirstOrDefault(r => r.RoleId == adminRole.Id).ShouldBeNull();
        }
        public async Task RemoveRoleFromOrganizationUnit()
        {
            using (var uow = _unitOfWorkManager.Begin())
            {
                var ou111 = await _organizationUnitRepository.GetAsync(
                    _lookupNormalizer.NormalizeName("OU111"));

                ou111.Roles.ShouldContain(q => q.RoleId == _testData.RoleModeratorId);

                await _organizationUnitManager.RemoveRoleFromOrganizationUnitAsync(_testData.RoleModeratorId, ou111.Id);

                await uow.CompleteAsync();
            }

            var ou111Updated = await _organizationUnitRepository.GetAsync(
                _lookupNormalizer.NormalizeName("OU111"));

            ou111Updated.Roles.ShouldNotContain(q => q.RoleId == _testData.RoleModeratorId);
        }