public async Task Handle() { var message = new TextActivity { Chat = new Chat { Id = "26" }, Text = "test", }; var messages = connector.Messages.Cast <TextActivity>(); await botHandler.Handle(message); Assert.AreEqual(state1.GetType().Name, messages.Last().Text); await botHandler.Handle(message); Assert.AreEqual(state2.GetType().Name, messages.Last().Text); await botHandler.Handle(message); Assert.AreEqual(state3.GetType().Name, messages.Last().Text); await botHandler.Handle(message); Assert.AreEqual(state1.GetType().Name, messages.Last().Text); }
public async Task Handle() { var json = File.ReadAllText("Jsons/Telegram/TextMessage.json"); var message = JsonConvert.DeserializeObject <TelegramActivity>(json); await botHandler.Handle(message); await botHandler.Handle(message); await botHandler.Handle(message); await botHandler.Handle(message); }
public async Task Handle() { var message = new TelegramActivity { Chat = new EasyBot.Framework.Models.Telegram.Chat { Id = 239678169 }, Text = "test", }; await botHandler.Handle(message); }
public async Task Handle() { var message = new TextActivity { Chat = new Chat { Id = "26" }, Text = "test", }; await botHandler.Handle(message); Assert.IsTrue(connector.Messages.Cast <TextActivity>().Any(s => s.Text == message.Text)); }
public async Task Handle() { var message = new TextActivity { Chat = new Chat { Id = "26" }, Text = "test", }; for (int i = 0; i < 5; i++) { await botHandler.Handle(message); Assert.IsTrue(connector.Messages.Cast <TextActivity>().Any(s => s.Text == $"Count: {i}")); } Assert.IsTrue(connector.Messages.Count == 5); }