Skip to content

Commit 1b04ed8

Browse files
committed
merge bug23541 into default
2 parents 587b7a0 + 1870a4b commit 1b04ed8

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

projects/client/Unit/src/unit/TestRecoverAfterCancel.cs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ [SetUp] public void Connect()
8484
{
8585
Connection = new ConnectionFactory().CreateConnection();
8686
Channel = Connection.CreateModel();
87-
Queue = Channel.QueueDeclare();
87+
Queue = Channel.QueueDeclare("", false, false, true, false, false, null);
8888
}
8989

9090
[TearDown] public void Disconnect()
@@ -98,18 +98,15 @@ public void TestRecoverAfterCancel_()
9898
UTF8Encoding enc = new UTF8Encoding();
9999
Channel.BasicPublish("", Queue, null, enc.GetBytes("message"));
100100
QueueingBasicConsumer Consumer = new QueueingBasicConsumer(Channel);
101-
QueueingBasicConsumer DefaultConsumer = new QueueingBasicConsumer(Channel);
102-
Channel.DefaultConsumer = DefaultConsumer;
101+
103102
String CTag = Channel.BasicConsume(Queue, null, Consumer);
104103
BasicDeliverEventArgs Event = (BasicDeliverEventArgs) Consumer.Queue.Dequeue();
105104
Channel.BasicCancel(CTag);
106-
Channel.BasicRecover(false);
107-
108-
// The server will now redeliver us the first message again, with the
109-
// same ctag, but we're not set up to handle it with a standard
110-
// consumer - it should end up with the default one.
105+
Channel.BasicRecover(true);
111106

112-
BasicDeliverEventArgs Event2 = (BasicDeliverEventArgs) DefaultConsumer.Queue.Dequeue();
107+
QueueingBasicConsumer Consumer2 = new QueueingBasicConsumer(Channel);
108+
Channel.BasicConsume(Queue, null, Consumer2);
109+
BasicDeliverEventArgs Event2 = (BasicDeliverEventArgs)Consumer2.Queue.Dequeue();
113110

114111
Assert.AreEqual(Event.Body, Event2.Body);
115112
Assert.IsFalse(Event.Redelivered);
@@ -121,7 +118,7 @@ public void TestRecoverCallback()
121118
{
122119
int callbackCount = 0;
123120
Channel.BasicRecoverOk += (sender, eventArgs) => callbackCount++;
124-
Channel.BasicRecover(false);
121+
Channel.BasicRecover(true);
125122
Assert.AreEqual(1, callbackCount);
126123
}
127124

0 commit comments

Comments
 (0)