Ejemplo n.º 1
0
        public void Should_throw_SubscriptionNotFoundException_if_subscription_not_found()
        {
            // Arrange
            var channel = Substitute.For <IModel>();

            channel.IsOpen.Returns(true);
            var subs         = new CompositeSubscription();
            var subscription = new Subscription
            {
                ConsumerTag      = "ConsumerTag",
                QueueName        = "QueueName",
                SubscriptionName = "SubscriptionName"
            };

            subscription.SetChannel(channel);
            subs.AddSubscription(subscription);

            // Action
            subs.NackAllOutstandingMessages("ConsumerTagNotFound", true);
        }
Ejemplo n.º 2
0
        public void Should_call_NackAllOutstandingMessages_on_nested_subscription()
        {
            // Arrange
            var channel = Substitute.For <IModel>();

            channel.IsOpen.Returns(true);
            var subs         = new CompositeSubscription();
            var subscription = new Subscription
            {
                ConsumerTag      = "ConsumerTag",
                QueueName        = "QueueName",
                SubscriptionName = "SubscriptionName"
            };

            subscription.SetChannel(channel);
            subs.AddSubscription(subscription);

            // Action
            subs.NackAllOutstandingMessages("ConsumerTag", true);

            // Assert
            channel.Received().BasicNack(0, true, true);
        }