public void RemovingUnassignedRoleDoesntThrow() { var command = new RemoveRoleFromNodeCommand("nodeId", "unassigned", "nodeId"); var handler = new RemoveRoleFromNodeCommandHandler(_nodeService); handler.Handle(command); }
public void RemovingRoleCreatesEvent() { var command = new RemoveRoleFromNodeCommand("nodeId", "role", "nodeId"); var handler = new RemoveRoleFromNodeCommandHandler(_nodeService); var result = handler.Handle(command); Assert.Contains(result.Events, x => x.Event.GetType() == typeof(NodeRolesUpdatedEvent)); }
public void RemovingRoleRemovesRole() { var command = new RemoveRoleFromNodeCommand("nodeId", "role", "nodeId"); var handler = new RemoveRoleFromNodeCommandHandler(_nodeService); handler.Handle(command); Assert.DoesNotContain(_nodeService.GetRoles("nodeId"), x => x == "role"); }
public void PassingInvalidNodeIdThrows() { Assert.Throws <NoSuchNodeException>(() => { var command = new RemoveRoleFromNodeCommand("invalidNodeId", "role", "nodeId"); var handler = new RemoveRoleFromNodeCommandHandler(_nodeService); handler.Handle(command); }); }
public async Task RemoveRole(string nodeId, string role) { var command = new RemoveRoleFromNodeCommand(nodeId, role, Context.ConnectionId); await _dispatcher.Dispatch(command); }