当前位置: 首页>>代码示例>>C#>>正文


C# Subscription.SetChannel方法代码示例

本文整理汇总了C#中Subscription.SetChannel方法的典型用法代码示例。如果您正苦于以下问题:C# Subscription.SetChannel方法的具体用法?C# Subscription.SetChannel怎么用?C# Subscription.SetChannel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Subscription的用法示例。


在下文中一共展示了Subscription.SetChannel方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Should_call_Nack_on_nested_subscriptions_with_all_delivery_tag

        public void Should_call_Nack_on_nested_subscriptions_with_all_delivery_tag()
        {
            // 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.Nack("ConsumerTag", new[] { (ulong)1, (ulong)2, (ulong)3, (ulong)4, (ulong)5 }, false);

            // Assert
            channel.Received().BasicNack(1, false, false);
            channel.Received().BasicNack(2, false, false);
            channel.Received().BasicNack(3, false, false);
            channel.Received().BasicNack(4, false, false);
            channel.Received().BasicNack(5, false, false);
        }
开发者ID:sovanesyan,项目名称:Burrow.NET,代码行数:25,代码来源:MethodNack.cs

示例2: Should_throw_SubscriptionNotFoundException_if_subscription_not_found

        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);
        }
开发者ID:sovanesyan,项目名称:Burrow.NET,代码行数:18,代码来源:MethodTryAckOrNAck.cs

示例3: Should_call_Nack_on_nested_subscriptions

        public void Should_call_Nack_on_nested_subscriptions()
        {
            // Arrange
            var channel = Substitute.For<IModel>();
            var subs = new CompositeSubscription();
            var subscription = new Subscription
            {
                ConsumerTag = "ConsumerTag",
                QueueName = "QueueName",
                SubscriptionName = "SubscriptionName"
            };
            subscription.SetChannel(channel);
            subs.AddSubscription(subscription);

            // Action
            subs.Nack("ConsumerTag", 1, false);

            // Assert
            channel.Received().BasicNack(1, false, false);
        }
开发者ID:brett--anderson,项目名称:Burrow.NET,代码行数:20,代码来源:MethodNack.cs

示例4: Should_call_AckAllOutstandingMessages_on_nested_subscription

        public void Should_call_AckAllOutstandingMessages_on_nested_subscription()
        {
            // Arrange
            var channel = Substitute.For<IModel>();
            var subs = new CompositeSubscription();
            var subscription = new Subscription
            {
                ConsumerTag = "ConsumerTag",
                QueueName = "QueueName",
                SubscriptionName = "SubscriptionName"
            };
            subscription.SetChannel(channel);
            subs.AddSubscription(subscription);

            // Action
            subs.AckAllOutstandingMessages("ConsumerTag");

            // Assert
            channel.Received().BasicAck(0, true);
        }
开发者ID:brett--anderson,项目名称:Burrow.NET,代码行数:20,代码来源:MethodAckAllOutstandingMessages.cs

示例5: Should_call_ack_on_nested_subscriptions_with_the_max_value_of_delivery_tag

        public void Should_call_ack_on_nested_subscriptions_with_the_max_value_of_delivery_tag()
        {
            // Arrange
            var channel = Substitute.For<IModel>();
            var subs = new CompositeSubscription();
            var subscription = new Subscription
            {
                ConsumerTag = "ConsumerTag",
                QueueName = "QueueName",
                SubscriptionName = "SubscriptionName"
            };
            subscription.SetChannel(channel);
            subs.AddSubscription(subscription);

            // Action
            subs.Ack("ConsumerTag", new[] { (ulong)1, (ulong)2, (ulong)3, (ulong)4, (ulong)5 });

            // Assert
            channel.Received().BasicAck(5, true);
        }
开发者ID:brett--anderson,项目名称:Burrow.NET,代码行数:20,代码来源:MethodAck.cs

示例6: Should_Nack_with_provided_delivery_tag_with_multiple_flag

        public void Should_Nack_with_provided_delivery_tag_with_multiple_flag()
        {
            // 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.NackAllUpTo("ConsumerTag", 10, false);

            // Assert
            channel.Received(1).BasicNack(10, true, false);
        }
开发者ID:kangkot,项目名称:Burrow.NET,代码行数:21,代码来源:MethodNackAllUpTo.cs

示例7: Should_call_cancel_on_nested_subscriptions

        public void Should_call_cancel_on_nested_subscriptions()
        {
            // 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.CancelAll();

            // Assert
            channel.Received().BasicCancel(subscription.ConsumerTag);
        }
开发者ID:kangkot,项目名称:Burrow.NET,代码行数:21,代码来源:MethodCancelAll.cs

示例8: Should_call_ack_on_nested_subscriptions_with_all_delivery_tag

        public void Should_call_ack_on_nested_subscriptions_with_all_delivery_tag()
        {
            // 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
            Subscription.OutstandingDeliveryTags["ConsumerTag"] = new List<ulong>();
            Subscription.OutstandingDeliveryTags["ConsumerTag"].AddRange(new ulong[] { 1, 2, 3, 4, 5 });
            subs.Ack("ConsumerTag", new[] { (ulong)1, (ulong)2, (ulong)3, (ulong)4, (ulong)5 });
            

            // Assert
            channel.Received().BasicAck(5, true);
        }
开发者ID:kangkot,项目名称:Burrow.NET,代码行数:24,代码来源:MethodAck.cs


注:本文中的Subscription.SetChannel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。