private void LoginAs(string name) { UnitOfWork.Start(() => { CurrentUser = ObjectFactory.GetInstance<IUserRepository>().GetUser(name); Allowed = ObjectFactory.GetInstance<IAuthorizationService>().IsAllowed(CurrentUser, "ButtonClick"); }); CurrentUserLabel.Text = CurrentUser.Name; button3.Enabled = Allowed; }
protected override void SharedContext() { _user = new User(); PermissionRepository = MockRepository.GenerateMock<IPermissionRepository>(); }
protected Permission GetPermission(bool isAllowed, User user, string actionName) { return new Permission(user, new Action {Name = actionName}, isAllowed); }