public JsonResult DeleteAuthenticablePrincipal(AuthenticablePrincipal entity)
 {
     try
     {
         userManagement.DeleteUser(entity, User);
         return(http.RespondSuccess());
     }
     catch
     {
         return(http.RespondServerError());
     }
 }
        public void UserManagementLogic_DeleteUser_Unauthorized_ThrowsUnauthorizedAccessException()
        {
            ClaimsPrincipal        user = new ClaimsPrincipal();
            AuthenticablePrincipal authenticablePrincipal = GetAuthenticablePrincipalValid();

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

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

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

            UserManagementLogic userManagementLogic = new UserManagementLogic(configurationRepository.Object, authorizationLogic.Object);

            userManagementLogic.DeleteUser(authenticablePrincipal, user);
        }