public void RoleManagementLogic_DeleteRole_Unauthorized_ThrowsUnauthorizedAccessException()
        {
            SecurityRole    securityRole = new SecurityRole();
            ClaimsPrincipal user         = new ClaimsPrincipal();

            Mock <IAuthorizationLogic> authorizationLogic = new Mock <IAuthorizationLogic>();

            authorizationLogic.Setup(x => x.IsAuthorizedThrowsException(AuthorizationScopes.ManageRoles, user, It.IsAny <ILoggableEntity>(), It.IsAny <EventCategory>())).Throws(new UnauthorizedAccessException());

            Mock <IConfigurationRepository> configurationRepository = new Mock <IConfigurationRepository>();

            RoleManagementLogic roleManagementLogic = new RoleManagementLogic(configurationRepository.Object, authorizationLogic.Object);

            roleManagementLogic.DeleteRole(securityRole, user);
        }
        public void RoleManagementLogic_DeleteRole_DeleteWellKnownAdministratorId_ThrowsInvalidOperationException()
        {
            SecurityRole securityRole = new SecurityRole()
            {
                Id = RoleManagementLogic.WellKnownAdministratorRoleId
            };

            ClaimsPrincipal user = new ClaimsPrincipal();

            Mock <IAuthorizationLogic> authorizationLogic = new Mock <IAuthorizationLogic>();

            authorizationLogic.Setup(x => x.IsAuthorizedThrowsException(AuthorizationScopes.ManageRoles, user, It.IsAny <ILoggableEntity>(), It.IsAny <EventCategory>()));

            Mock <IConfigurationRepository> configurationRepository = new Mock <IConfigurationRepository>();

            RoleManagementLogic roleManagementLogic = new RoleManagementLogic(configurationRepository.Object, authorizationLogic.Object);

            roleManagementLogic.DeleteRole(securityRole, user);
        }
 public JsonResult DeleteRole(SecurityRole entity)
 {
     roleManagement.DeleteRole(entity, User);
     return(http.RespondSuccess());
 }