示例#1
0
        public async Task Handle(Update update)
        {
            if (update.Type != UpdateType.MessageUpdate)
            {
                return;
            }
            var message = update.Message;

            switch (message.Type)
            {
            case MessageType.TextMessage:
                var result = await _textMessageProcessor.Process(message.Text);

                await _botService.Client.SendTextMessageAsync(message.Chat.Id, result.Content, ParseMode.Markdown,
                                                              false, false, message.MessageId, result.ReplyMarkup);

                break;

            case MessageType.PhotoMessage:
                await _botService.Client.SendTextMessageAsync(message.Chat.Id, "Изображение обработано.");

                break;

            default:
                break;
            }
        }
        public async Task Should_Call_DietDecisionMaker_Allow_Banana(string message)
        {
            using (var context = new DietContext(_options))
            {
                ContextInitializer.Initialize(context);
                var textMessageProcessor = new TextMessageProcessor(context, new NullLogger <TextMessageProcessor>());
                var result = await textMessageProcessor.Process(message);

                Assert.False(string.IsNullOrEmpty(result.Content));
            }
        }