Binboo.Tests.Mocks.ChatMock.WaitForMessages C# (CSharp) Method

WaitForMessages() public method

public WaitForMessages ( int timeout ) : bool
timeout int
return bool
        public bool WaitForMessages(int timeout)
        {
            bool ret = _messageEvent.WaitOne(timeout);
            _messageEvent.Reset();

            return ret;
        }

Usage Example

Example #1
0
        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.");
        }