本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}