private TestContext CreateContext()
        {
            var set = HareConsumerSettings.GetDefaultSettings();

            set.IntervalConnectionTries     = TimeSpan.Zero;
            set.HandleMessagesSynchronously = true;
            var props = new Mock <IBasicProperties>();
            var model = new Mock <IModel>(MockBehavior.Strict);

            model.Setup(m => m.CreateBasicProperties()).Returns(props.Object);
            model.Setup(m => m.BasicQos(It.IsAny <uint>(), It.IsAny <ushort>(), It.IsAny <bool>()));
            model.Setup(m => m.BasicConsume(It.IsAny <string>(), It.IsAny <bool>(), It.IsAny <string>(), It.IsAny <BaseConsumer>())).Returns("test");
            model.Setup(m => m.BasicCancel(It.IsAny <string>()));
            model.Setup(m => m.Close());

            var connection = new Mock <IConnection>();

            connection.Setup(c => c.CreateModel()).Returns(model.Object);

            var consumer = new RabbitMQHare.RabbitConsumer(set, new RabbitExchange("testing"))
            {
                CreateConnection    = () => connection.Object,
                RedeclareMyTopology = m => { },
            };

            return(new TestContext()
            {
                Consumer = consumer,
                Model = model
            });
        }
        public void PlugGenericHandler()
        {
            var set      = HareConsumerSettings.GetDefaultSettings();
            var consumer = new RabbitMQHare.RabbitConsumer(set, new RabbitExchange("test"));

            consumer.HasEnoughEventHandlers(0);
            consumer.PlugGenericHook((m, e) => { });
            consumer.HasEnoughEventHandlers(1, ignored: "EventHandlerFailureHandler");
        }