Beispiel #1
0
        public void testSendAndClear()
        {
            ThreadLocalChannel channel  = new ThreadLocalChannel();
            StringMessage      message1 = new StringMessage("test1");
            StringMessage      message2 = new StringMessage("test2");

            Assert.IsNull(channel.Receive());
            Assert.IsTrue(channel.Send(message1));
            Assert.IsTrue(channel.Send(message2));
            IList <IMessage> clearedMessages = channel.Clear();

            Assert.That(clearedMessages.Count, Is.EqualTo(2));
            Assert.That(clearedMessages[0], Is.EqualTo(message1));
            Assert.That(clearedMessages[1], Is.EqualTo(message2));
            Assert.IsNull(channel.Receive());
        }
Beispiel #2
0
        public void testSendAndReceive()
        {
            ThreadLocalChannel channel = new ThreadLocalChannel();
            StringMessage      message = new StringMessage("test");

            Assert.IsNull(channel.Receive());
            Assert.IsTrue(channel.Send(message));
            IMessage response = channel.Receive();

            Assert.IsNotNull(response);
            Assert.That(message, Is.EqualTo(response));
            Assert.IsNull(channel.Receive());
        }