public void Setup() { _app = Application.WithPluginsFrom(new TypeCatalog(typeof (ArgumentEchoingPlugin))); _app.Error += (sender, e) => _errors.Add(e.Message + "\r\n" + e.Details); _chat = new ChatMock(NewUserMock()); _mockSkype = new SkypeMock(() => _chat); _app.SetSkype(_mockSkype); _app.AttachToSkype(); }
public void MissedMessagesAreProcessed() { var app = Application.WithPluginsFrom(new TypeCatalog(typeof(TestPlugin1))); var chat = new ChatMock(NewUserMock()); var skype = new SkypeMock(() => chat, MissedMessages()); app.SetSkype(skype); app.AttachToSkype(); //TODO: Fix race condition... sometimes the following asserts fails Assert.That(chat.WaitForMessages(1000), Is.True); AssertErrorResponse(chat, "Unknown command: cmd1."); AssertErrorResponse(chat, "Unknown command: cmd2."); AssertErrorResponse(chat, "Unknown command: cmd3."); }
private static void AssertErrorResponse(ChatMock chat, string errorMsg) { Assert.IsTrue(chat.SentMessages.Select(m => m.Body).Contains(errorMsg), string.Format("Expected response not fould: '{0}'", errorMsg)); }