Example #1
0
        public async Task <CommandExecutionResult> Execute(string commandBody)
        {
            var command = await Parse(commandBody);

            if (command == null)
            {
                return(CommandExecutionResult.NotRecognized());
            }

            if (_validator != null)
            {
                var(success, errors) = _validator.Validate(command);
                if (!success)
                {
                    return(CommandExecutionResult.ValidationFailure(string.Join("; ", errors)));
                }
            }

            return(await Execute(command));
        }