public void TestMessageCache()
        {
            TrackingTransport      transport = new TrackingTransport();
            ConnectionStateTracker tracker   = new ConnectionStateTracker();

            tracker.TrackMessages = true;

            ConnectionData conn = CreateConnectionState(tracker);

            tracker.MaxCacheSize = 4;

            int sequenceId = 1;

            for (int i = 0; i < 10; ++i)
            {
                MessageId id = new MessageId();
                id.ProducerId         = conn.producer.ProducerId;
                id.ProducerSequenceId = sequenceId++;
                Message message = new Message();
                message.MessageId = id;

                tracker.ProcessMessage(message);
                tracker.TrackBack(message);
            }

            tracker.DoRestore(transport);

            Assert.AreEqual(4, transport.messages.Count);
        }
        public void TestMessagePullCache2()
        {
            TrackingTransport      transport = new TrackingTransport();
            ConnectionStateTracker tracker   = new ConnectionStateTracker();

            tracker.TrackMessages = true;

            tracker.MaxCacheSize = 10;
            ConnectionData conn = CreateConnectionState(tracker);

            for (int i = 0; i < 100; ++i)
            {
                MessagePull         pull        = new MessagePull();
                ActiveMQDestination destination = new ActiveMQTopic("TEST");
                pull.ConsumerId  = conn.consumer.ConsumerId;
                pull.Destination = destination;
                tracker.ProcessMessagePull(pull);
                tracker.TrackBack(pull);
            }

            tracker.DoRestore(transport);

            Assert.AreEqual(1, transport.messagePulls.Count);
        }