Skip to content

Commit 822850e

Browse files
committed
* Fix test
1 parent e964cb2 commit 822850e

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

projects/Test/Integration/ConnectionRecovery/EventHandlerRecovery/Connection/TestRecoveringConsumerEventHandlers.cs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,17 @@ public async Task TestRecoveringConsumerEventHandlers_Called(int iterations)
6969
[Fact]
7070
public async Task TestRecoveringConsumerEventHandler_EventArgumentsArePassedDown()
7171
{
72-
var myArgs = new Dictionary<string, object> { { "first-argument", "some-value" } };
72+
const string key = "first-argument";
73+
const string value = "some-value";
74+
75+
IDictionary<string, object> arguments = new Dictionary<string, object>
76+
{
77+
{ key, value }
78+
};
79+
7380
RabbitMQ.Client.QueueDeclareOk q = await _channel.QueueDeclareAsync(GenerateQueueName(), false, false, false);
7481
var cons = new EventingBasicConsumer(_channel);
75-
string expectedCTag = await _channel.BasicConsumeAsync(cons, q, arguments: myArgs);
82+
string expectedCTag = await _channel.BasicConsumeAsync(cons, q, arguments: arguments);
7683

7784
bool ctagMatches = false;
7885
bool consumerArgumentMatches = false;
@@ -82,15 +89,14 @@ public async Task TestRecoveringConsumerEventHandler_EventArgumentsArePassedDown
8289
// passed to a CallbackExceptionHandler, instead of failing the test. Instead, we have to do this trick
8390
// and assert in the test function.
8491
ctagMatches = args.ConsumerTag == expectedCTag;
85-
consumerArgumentMatches = (string)args.ConsumerArguments["first-argument"] == "some-value";
86-
args.ConsumerArguments["first-argument"] = "event-handler-set-this-value";
92+
consumerArgumentMatches = (string)args.ConsumerArguments[key] == value;
8793
};
8894

8995
await CloseAndWaitForRecoveryAsync();
9096
Assert.True(ctagMatches, "expected consumer tag to match");
9197
Assert.True(consumerArgumentMatches, "expected consumer arguments to match");
92-
string actualVal = (string)Assert.Contains("first-argument", myArgs as IDictionary<string, object>);
93-
Assert.Equal("event-handler-set-this-value", actualVal);
98+
string actualVal = (string)Assert.Contains(key, arguments);
99+
Assert.Equal(value, actualVal);
94100
}
95101
}
96102
}

projects/Test/SequentialIntegration/TestQueueRecoveryWithArguments.cs renamed to projects/Test/Integration/ConnectionRecovery/TestQueueRecoveryWithArguments.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@
3636
using Xunit;
3737
using Xunit.Abstractions;
3838

39-
namespace Test.SequentialIntegration
39+
namespace Test.Integration.ConnectionRecovery
4040
{
41-
public class TestQueueRecoveryWithArguments : SequentialIntegrationFixture
41+
public class TestQueueRecoveryWithArguments : TestConnectionRecoveryBase
4242
{
4343
public TestQueueRecoveryWithArguments(ITestOutputHelper output) : base(output)
4444
{
@@ -81,6 +81,12 @@ await _channel.ExchangeDeclareAsync(exchange: tdiRetryExchangeName,
8181
await _channel.BasicConsumeAsync(queue: testQueueName, autoAck: false, consumer: consumerAsync);
8282

8383
await CloseAndWaitForRecoveryAsync();
84+
85+
QueueDeclareOk q0 = await _channel.QueueDeclarePassiveAsync(testRetryQueueName);
86+
Assert.Equal(testRetryQueueName, q0.QueueName);
87+
88+
QueueDeclareOk q1 = await _channel.QueueDeclarePassiveAsync(testQueueName);
89+
Assert.Equal(testQueueName, q1.QueueName);
8490
}
8591
}
8692
}

0 commit comments

Comments
 (0)