public PermissionsTests() { _permissionService = new PermissionService(); _currentUser = new Operator { Name = "Test Current User", Key = "CurrentUser", CanCreatePermissions = true }; }
public RolesTests() { _roleService = new RoleService(); _permissionService = new PermissionService(); _currentUser = new Operator { Name = "Current User", Key = "cu", CanCreatePermissions = true, CanCreateRoles = true }; }
public UserTests() { _cu = new Operator { CanCreatePermissions = true, CanCreateRoles = true, CanCreateUsers = true }; _user = User.Blank(); var ps = new PermissionService(); _permissionOne = Permission.Create(ps, _cu, new PermissionKey("perm-one"), "One", ""); _permissionTwo = Permission.Create(ps, _cu, new PermissionKey("perm-two"), "Two", ""); }
public Boot( Projectionist projectionist, AggregateStore<Guid> store, UserService users, RoleService roles, PermissionService permissions, CollectionsReadModel collectionsReadModel, HistoryReadModel history, AuthorizationReadModel authorizationRead) { _projectionist = projectionist; _store = store; projectionist .Add(users) .Add(roles) .Add(permissions) .Add(collectionsReadModel.Project) .Add(history.Project) .Add(authorizationRead.Project); }
public void Multiple_roles_with_the_same_key_cannot_be_created() { var service = new PermissionService(); var p1 = Permission.Create(service, _currentUser, new PermissionKey("1"), "name", "desc"); //simulate saving to the eventstore p1.GetUncommittedEvents().ForEach(service.Project); Should .Throw<DuplicatePermissionException>(() => Permission.Create(service, _currentUser, new PermissionKey("1"), "new", "newer")) .Message .ShouldBe("There is already a Permission with the key '1'"); }