@@ -744,10 +744,17 @@ public void TestRecoveringConsumerHandlerOnConnection()
744
744
[ Test ]
745
745
public void TestRecoveringConsumerHandlerOnConnection_EventArgumentsArePassedDown ( )
746
746
{
747
- var myArgs = new Dictionary < string , object > { { "first-argument" , "some-value" } } ;
747
+ const string key = "first-argument" ;
748
+ const string value = "some-value" ;
749
+
750
+ IDictionary < string , object > arguments = new Dictionary < string , object >
751
+ {
752
+ { key , value }
753
+ } ;
754
+
748
755
string q = Model . QueueDeclare ( GenerateQueueName ( ) , false , false , false , null ) . QueueName ;
749
756
var cons = new EventingBasicConsumer ( Model ) ;
750
- string expectedCTag = Model . BasicConsume ( cons , q , arguments : myArgs ) ;
757
+ string expectedCTag = Model . BasicConsume ( cons , q , arguments : arguments ) ;
751
758
752
759
bool ctagMatches = false ;
753
760
bool consumerArgumentMatches = false ;
@@ -757,14 +764,15 @@ public void TestRecoveringConsumerHandlerOnConnection_EventArgumentsArePassedDow
757
764
// passed to a CallbackExceptionHandler, instead of failing the test. Instead, we have to do this trick
758
765
// and assert in the test function.
759
766
ctagMatches = args . ConsumerTag == expectedCTag ;
760
- consumerArgumentMatches = ( string ) args . ConsumerArguments [ "first-argument" ] == "some-value" ;
761
- args . ConsumerArguments [ "first-argument" ] = "event-handler-set-this-value" ;
767
+ consumerArgumentMatches = ( string ) args . ConsumerArguments [ key ] == value ;
762
768
} ;
763
769
764
770
CloseAndWaitForRecovery ( ) ;
765
771
Assert . That ( ctagMatches , Is . True , "expected consumer tag to match" ) ;
766
772
Assert . That ( consumerArgumentMatches , Is . True , "expected consumer arguments to match" ) ;
767
- Assert . That ( myArgs , Does . ContainKey ( "first-argument" ) . WithValue ( "event-handler-set-this-value" ) ) ;
773
+ Assert . That ( arguments . ContainsKey ( key ) , Is . True ) ;
774
+ string actualVal = arguments [ key ] ;
775
+ Assert . That ( actualVal , Is . EqualTo ( value ) ) ;
768
776
}
769
777
770
778
[ Test ]
0 commit comments