protected AbstractWebApiController(IMapper mapper, IUnitOfWork unitOfWork, ShroomsUserManager userManager, ShroomsRoleManager roleManager, string defaultOrderByProperty = null)
 {
     _mapper                 = mapper;
     _unitOfWork             = unitOfWork;
     _repository             = _unitOfWork.GetRepository <TModel>();
     UserManager             = userManager;
     RoleManager             = roleManager;
     _defaultOrderByProperty = defaultOrderByProperty;
 }
        public void TestInitializer()
        {
            _unitOfWork  = new MockUnitOfWork();
            _userStore   = MockIdentity.MockShroomsUserStore(_unitOfWork.DbContext);
            _roleStore   = MockIdentity.MockRoleStore();
            _userManager = MockIdentity.MockUserManager(_userStore, _unitOfWork.DbContext);
            _roleManager = MockIdentity.MockRoleManager(_roleStore);
            _mapper      = ModelMapper.Create();

            _officeController = new OfficeController(_mapper, _unitOfWork);
            _officeController.ControllerContext = Substitute.For <HttpControllerContext>();
            _officeController.Request           = new HttpRequestMessage();
            _officeController.Request.Properties.Add(HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration());
            _officeController.Request.SetConfiguration(new HttpConfiguration());
            _officeController.RequestContext.Principal =
                new ClaimsPrincipal(new ClaimsIdentity(new[] { new Claim(ClaimTypes.NameIdentifier, "1") }));
        }
Example #3
0
        public RolesController(IMapper mapper,
                               IUnitOfWork unitOfWork,
                               IPermissionService permissionService,
                               ICustomCache <string, IEnumerable <string> > permissionsCache,
                               IRoleService roleService,
                               ShroomsUserManager userManager = null,
                               ShroomsRoleManager roleManager = null)
        {
            _mapper                    = mapper;
            _unitOfWork                = unitOfWork;
            _permissionsCache          = permissionsCache;
            _permissionService         = permissionService;
            _roleService               = roleService;
            _roleRepository            = unitOfWork.GetRepository <ApplicationRole>();
            _permissionRepository      = unitOfWork.GetRepository <Permission>();
            _applicationUserRepository = unitOfWork.GetRepository <ApplicationUser>();

            _roleManager = roleManager;
            _userManager = userManager;
        }
 public AbstractClassifierController(IMapper mapper, IUnitOfWork unitOfWork, ShroomsUserManager userManager, ShroomsRoleManager roleManager)
     : base(mapper, unitOfWork, userManager, roleManager, null)
 {
     _classifierRepository = unitOfWork.GetRepository <AbstractClassifier>();
 }
Example #5
0
 public OrganizationController(IMapper mapper, IUnitOfWork unitOfWork, ShroomsUserManager userManager, ShroomsRoleManager roleManager, IOrganizationService organizationService)
     : base(mapper, unitOfWork, userManager, roleManager, null)
 {
     _pageRepository       = unitOfWork.GetRepository <Page>();
     _permissionRepository = unitOfWork.GetRepository <Permission>();
     _organizationService  = organizationService;
 }
Example #6
0
 public RoomController(IMapper mapper, IUnitOfWork unitOfWork, ShroomsUserManager userManager, ShroomsRoleManager roleManager)
     : base(mapper, unitOfWork, userManager, roleManager, "Id")
 {
 }
Example #7
0
 public OrganizationController(IMapper mapper, IUnitOfWork unitOfWork, ShroomsUserManager userManager, ShroomsRoleManager roleManager, IOrganizationService organizationService)
     : base(mapper, unitOfWork, userManager, roleManager)
 {
     _organizationService = organizationService;
 }