Inheritance: IMessageProcessor
        public void ContainerHostMessageProcessorTest()
        {
            string name      = MethodInfo.GetCurrentMethod().Name;
            var    processor = new TestMessageProcessor();

            this.host.RegisterMessageProcessor(name, processor);

            int count      = 500;
            var connection = new Connection(Address);
            var session    = new Session(connection);
            var sender     = new SenderLink(session, "send-link", name);

            for (int i = 0; i < count; i++)
            {
                var message = new Message("msg" + i);
                message.Properties = new Properties()
                {
                    GroupId = name
                };
                sender.Send(message, SendTimeout);
            }

            sender.Close();
            session.Close();
            connection.Close();

            Assert.AreEqual(count, processor.Messages.Count);
            for (int i = 0; i < count; i++)
            {
                var message = processor.Messages[i];
                Assert.AreEqual("msg" + i, message.GetBody <string>());
            }
        }
        public void ContainerHostMultipleClientsTest()
        {
            string name      = "ContainerHostMultipleClientsTest";
            var    processor = new TestMessageProcessor();

            this.host.RegisterMessageProcessor(name, processor);

            var connection = new Connection(Address);

            // client 1
            {
                var session = new Session(connection);
                var sender  = new SenderLink(session, "send-link-1", name);
                sender.Send(new Message("msg1"), Timeout);
            }

            // client 2
            {
                var session = new Session(connection);
                var sender  = new SenderLink(session, "send-link-2", name);
                sender.Send(new Message("msg2"), Timeout);
            }

            connection.Close();
        }
        public void ContainerHostMessageProcessorUnregisterTest()
        {
            string name      = "ContainerHostMessageProcessorUnregisterTest";
            var    processor = new TestMessageProcessor();

            this.host.RegisterMessageProcessor(name, processor);

            int count      = 5;
            var connection = new Connection(Address);
            var session    = new Session(connection);
            var sender     = new SenderLink(session, "send-link", name);

            for (int i = 0; i < count; i++)
            {
                var message = new Message("msg" + i);
                message.Properties = new Properties()
                {
                    MessageId = name + i
                };
                sender.Send(message, SendTimeout);
            }

            this.host.UnregisterMessageProcessor(name);

            connection.Close();
        }
        public void ContainerHostMessageProcessorTest()
        {
            string name = MethodInfo.GetCurrentMethod().Name;
            var processor = new TestMessageProcessor();
            this.host.RegisterMessageProcessor(name, processor);

            int count = 500;
            var connection = new Connection(Address);
            var session = new Session(connection);
            var sender = new SenderLink(session, "send-link", name);

            for (int i = 0; i < count; i++)
            {
                var message = new Message("msg" + i);
                message.Properties = new Properties() { GroupId = name };
                sender.Send(message, SendTimeout);
            }

            sender.Close();
            session.Close();
            connection.Close();

            Assert.AreEqual(count, processor.Messages.Count);
            for (int i = 0; i < count; i++)
            {
                var message = processor.Messages[i];
                Assert.AreEqual("msg" + i, message.GetBody<string>());
            }
        }
        public void ContainerHostMessageProcessorUnregisterTest()
        {
            string name = "ContainerHostMessageProcessorUnregisterTest";
            var processor = new TestMessageProcessor();
            this.host.RegisterMessageProcessor(name, processor);

            int count = 5;
            var connection = new Connection(Address);
            var session = new Session(connection);
            var sender = new SenderLink(session, "send-link", name);

            for (int i = 0; i < count; i++)
            {
                var message = new Message("msg" + i);
                message.Properties = new Properties() { MessageId = name + i };
                sender.Send(message, SendTimeout);
            }

            this.host.UnregisterMessageProcessor(name);

            connection.Close();
        }