public void CommandExecutes_NoExceptions() { void call() => commandService.Handle("/stock=aapl.us", _ => { }); var exception = Record.Exception(call); Assert.Null(exception); }
public async Task SendMessage(ChatMessageViewModel messageModel) { var isCommand = _commandService.IsCommand(messageModel.Body); messageModel.CreatedOn = DateTime.Now; messageModel.Body = messageModel.Body.Trim(); await SendMessageToAll(messageModel, isCommand); try { if (isCommand) { _commandService.Handle(messageModel.Body, command => { _stockSender.Send(command.Value); }); } else { await _messagesRepository.Insert(new ChatMessage { CreatedOn = messageModel.CreatedOn, UserId = messageModel.UserId, Body = messageModel.Body }); } } catch (CommandException e) { await SendMessageFromBot(e.Message); } }