public void TestConsumerCancel(string queue, bool EventMode, ref bool notified)
        {
            Model.QueueDeclare(queue, false, true, false, null);
            IBasicConsumer consumer = new CancelNotificationConsumer(Model, this, EventMode);
            Model.BasicConsume(queue, false, consumer);

            Model.QueueDelete(queue);
            WaitOn(lockObject);
            Assert.IsTrue(notified);
        }
Example #2
0
        public void TestConsumerCancel(string queue, bool EventMode, ref bool notified)
        {
            Model.QueueDeclare(queue, false, true, false, null);
            IBasicConsumer consumer          = new CancelNotificationConsumer(Model, this, EventMode);
            var            actualConsumerTag = Model.BasicConsume(queue, false, consumer);

            Model.QueueDelete(queue);
            WaitOn(lockObject);
            Assert.IsTrue(notified);
            Assert.AreEqual(actualConsumerTag, consumerTag);
        }
Example #3
0
        private void TestConsumerCancel(string queue, bool EventMode, ref bool notified)
        {
            _model.QueueDeclare(queue, false, true, false, null);
            IBasicConsumer consumer          = new CancelNotificationConsumer(_model, this, EventMode);
            string         actualConsumerTag = _model.BasicConsume(queue, false, consumer);

            _model.QueueDelete(queue);
            WaitOn(lockObject);
            Assert.True(notified);
            Assert.Equal(actualConsumerTag, consumerTag);
        }
        public void TestConsumerCancel(string queue, bool EventMode, ref bool notified)
        {
            Model.QueueDeclare(queue, false, true, false, null);
            IBasicConsumer consumer = new CancelNotificationConsumer(Model, this, EventMode);
            Model.BasicConsume(queue, false, consumer);

            Model.QueueDelete(queue);
            lock (lockObject)
            {
                if (!notified)
                {
                    Monitor.Wait(lockObject, TimingFixture.TestTimeout);
                }
                Assert.IsTrue(notified);
            }
        }
        public void TestConsumerCancelNotification()
        {
            string queue = "queue_consumer_notify";
            ConnectionFactory connFactory = new ConnectionFactory();
            IConnection conn = connFactory.CreateConnection();
            IModel chan = conn.CreateModel();
            chan.QueueDeclare(queue, false, true, false, null);
            IBasicConsumer consumer = new CancelNotificationConsumer(chan, this);
            chan.BasicConsume(queue, false, consumer);

            chan.QueueDelete(queue);
            lock (lockObject) {
                if (!notified) {
                    Monitor.Wait(lockObject);
                }
                Assert.IsTrue(notified);
            }
        }