public void TestModelShutdownHandler()
        {
            var latch = new ManualResetEvent(false);
            var q     = this.Model.QueueDeclare().QueueName;
            var c     = new ShutdownLatchConsumer(latch);

            this.Model.BasicConsume(queue: q, noAck: true, consumer: c);
            this.Model.Close();
            Wait(latch, TimeSpan.FromSeconds(5));
        }
        public void TestModelShutdownHandler()
        {
            var    latch          = new ManualResetEventSlim(false);
            var    duplicateLatch = new ManualResetEventSlim(false);
            string q = Model.QueueDeclare().QueueName;
            var    c = new ShutdownLatchConsumer(latch, duplicateLatch);

            Model.BasicConsume(queue: q, autoAck: true, consumer: c);
            Model.Close();
            Wait(latch, TimeSpan.FromSeconds(5));
            Assert.IsFalse(duplicateLatch.Wait(TimeSpan.FromSeconds(5)),
                           "event handler fired more than once");
        }
        public void TestModelShutdownHandler()
        {
            var latch = new ManualResetEvent(false);
            var duplicateLatch = new ManualResetEvent(false);
            var q = this.Model.QueueDeclare().QueueName;
            var c = new ShutdownLatchConsumer(latch, duplicateLatch);

            this.Model.BasicConsume(queue: q, autoAck: true, consumer: c);
            this.Model.Close();
            Wait(latch, TimeSpan.FromSeconds(5));
            Assert.IsFalse(duplicateLatch.WaitOne(TimeSpan.FromSeconds(5)),
                           "event handler fired more than once");
        }
        public void TestModelShutdownHandler()
        {
            var latch = new ManualResetEvent(false);
            var q = this.Model.QueueDeclare().QueueName;
            var c = new ShutdownLatchConsumer(latch);

            this.Model.BasicConsume(queue: q, noAck: true, consumer: c);
            this.Model.Close();
            Wait(latch, TimeSpan.FromSeconds(5));
        }