public RemoveRoleFromNodeCommandHandlerTests()
        {
            IBoutRunnerService boutRunnerService = new BoutRunnerService();

            _nodeService = new NodeService(boutRunnerService);
            _nodeService.ConnectNode("nodeId", "connectionId");
            _nodeService.AddRole("nodeId", "role");
        }
Example #2
0
        public override ICommandResponse Handle(AssignRoleToNodeCommand command)
        {
            var response = new CommandResponse();

            //If in role, no nothing.
            if (!_nodeService.IsInRole(command.NodeId, command.Role))
            {
                _nodeService.AddRole(command.NodeId, command.Role);
                response.AddEvent(new NodeRolesUpdatedEvent(command.NodeId, _nodeService.GetRoles(command.NodeId)), _nodeService.GetConnection(command.NodeId));
                response.AddEvent(new NodeRolesUpdatedEvent(command.NodeId, _nodeService.GetRoles(command.NodeId)), command.Originator);
            }
            return(response);
        }