示例#1
0
        static ControllerHelper()
        {
            var mockPrincipal = new Mock <IBusinessLogicPrincipal>();

            mockPrincipal.Setup(x => x.IsAllowed).Returns(true);
            mockPrincipal.Setup(x => x.IsAdmin).Returns(true);
            mockPrincipal.Setup(x => x.IsVerwalter).Returns(true);
            mockPrincipal.Setup(x => x.CurrentUid).Returns("if15b032");
            _abl  = new AccessoryBusinessLogic(_dal, mockPrincipal.Object);
            _cbl  = new CustomFieldsBusinessLogic(_dal, mockPrincipal.Object);
            _dbl  = new DamageBusinessLogic(_dal, mockPrincipal.Object);
            _debl = new DeviceBusinessLogic(_dal, mockPrincipal.Object);
            _blbl = new BusinessLogic.BusinessLogic(_dal, mockPrincipal.Object);
            _obl  = new OrderBusinessLogic(_dal, mockPrincipal.Object);
            _sbl  = new SettingBusinessLogic(_dal, mockPrincipal.Object);
            _ubl  = new UserBusinessLogic(_dal, mockPrincipal.Object);
            _bl   = new BusinessLogicFacade(_dal, _blbl, _abl, _cbl, _dbl, _debl, _obl, _sbl, _ubl);

            Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");
            var subject = new ClaimsIdentity("Federation", ClaimTypes.Name, ClaimTypes.Role);

            subject.AddClaim(new Claim(ClaimTypes.Role, "Admin", ClaimValueTypes.String));
            subject.AddClaim(new Claim(ClaimTypes.Name, "if15b032", ClaimValueTypes.String));
            Thread.CurrentPrincipal = new ClaimsPrincipal(subject);
        }
示例#2
0
        public BLTests()
        {
            var mockPrincipal = new Mock <IBusinessLogicPrincipal>();

            mockPrincipal.Setup(x => x.IsAllowed).Returns(true);
            mockPrincipal.Setup(x => x.IsAdmin).Returns(true);
            mockPrincipal.Setup(x => x.IsVerwalter).Returns(true);
            mockPrincipal.Setup(x => x.CurrentUid).Returns("if15b032");
            _abl  = new AccessoryBusinessLogic(_dal, mockPrincipal.Object);
            _cbl  = new CustomFieldsBusinessLogic(_dal, mockPrincipal.Object);
            _dbl  = new DamageBusinessLogic(_dal, mockPrincipal.Object);
            _debl = new DeviceBusinessLogic(_dal, mockPrincipal.Object);
            _blbl = new BusinessLogic.BusinessLogic(_dal, mockPrincipal.Object);
            _obl  = new OrderBusinessLogic(_dal, mockPrincipal.Object);
            _sbl  = new SettingBusinessLogic(_dal, mockPrincipal.Object);
            _ubl  = new UserBusinessLogic(_dal, mockPrincipal.Object);
            _bl   = new BusinessLogicFacade(_dal, _blbl, _abl, _cbl, _dbl, _debl, _obl, _sbl, _ubl);
        }
示例#3
0
 public BusinessLogicFacade(
     IDataAccessLayer dal,
     IBusinessLogic bl,
     IAccessoryBusinessLogic accessoryBl,
     ICustomFieldsBusinessLogic cfBl,
     IDamageBusinessLogic damageBl,
     IDeviceBusinessLogic deviceBl,
     IOrderBusinessLogic orderBl,
     ISettingBusinessLogic settingBl,
     IUserBusinessLogic userBl)
 {
     _dal         = dal;
     _bl          = bl;
     _accessoryBl = accessoryBl;
     _cfBl        = cfBl;
     _damageBl    = damageBl;
     _deviceBl    = deviceBl;
     _orderBl     = orderBl;
     _settingBl   = settingBl;
     _userBl      = userBl;
 }