@@ -47,26 +47,30 @@ public TestRecoveryWithDeletedEntities(ITestOutputHelper output) : base(output)
4747 public async Task TestThatDeletedExchangeBindingsDontReappearOnRecovery ( )
4848 {
4949 string q = ( await _channel . QueueDeclareAsync ( "" , false , false , false ) ) . QueueName ;
50- string x1 = "amq.fanout" ;
51- string x2 = GenerateExchangeName ( ) ;
5250
53- await _channel . ExchangeDeclareAsync ( x2 , "fanout" ) ;
54- await _channel . ExchangeBindAsync ( x1 , x2 , "" ) ;
55- await _channel . QueueBindAsync ( q , x1 , "" ) ;
56- await _channel . ExchangeUnbindAsync ( x1 , x2 , "" ) ;
51+ string ex_source = GenerateExchangeName ( ) ;
52+ string ex_destination = GenerateExchangeName ( ) ;
53+
54+ await _channel . ExchangeDeclareAsync ( ex_source , ExchangeType . Fanout ) ;
55+ await _channel . ExchangeDeclareAsync ( ex_destination , ExchangeType . Fanout ) ;
56+
57+ await _channel . ExchangeBindAsync ( destination : ex_destination , source : ex_source , "" ) ;
58+ await _channel . QueueBindAsync ( q , ex_destination , "" ) ;
59+ await _channel . ExchangeUnbindAsync ( ex_destination , ex_source , "" ) ;
5760
5861 try
5962 {
6063 await CloseAndWaitForRecoveryAsync ( ) ;
6164 Assert . True ( _channel . IsOpen ) ;
62- await _channel . BasicPublishAsync ( x2 , "" , _encoding . GetBytes ( "msg" ) ) ;
65+ await _channel . BasicPublishAsync ( ex_source , "" , _encoding . GetBytes ( "msg" ) ) ;
6366 await AssertMessageCountAsync ( q , 0 ) ;
6467 }
6568 finally
6669 {
6770 await WithTemporaryChannelAsync ( async ch =>
6871 {
69- await ch . ExchangeDeleteAsync ( x2 ) ;
72+ await ch . ExchangeDeleteAsync ( ex_source ) ;
73+ await ch . ExchangeDeleteAsync ( ex_destination ) ;
7074 await ch . QueueDeleteAsync ( q ) ;
7175 } ) ;
7276 }
@@ -97,26 +101,30 @@ public async Task TestThatDeletedExchangesDontReappearOnRecovery()
97101 public async Task TestThatDeletedQueueBindingsDontReappearOnRecovery ( )
98102 {
99103 string q = ( await _channel . QueueDeclareAsync ( "" , false , false , false ) ) . QueueName ;
100- string ex_amq_fanout = "amq.fanout" ;
101- string ex_test = GenerateExchangeName ( ) ;
102104
103- await _channel . ExchangeDeclareAsync ( ex_test , ExchangeType . Fanout ) ;
104- await _channel . ExchangeBindAsync ( destination : ex_amq_fanout , source : ex_test , routingKey : "" ) ;
105- await _channel . QueueBindAsync ( q , ex_amq_fanout , "" ) ;
106- await _channel . QueueUnbindAsync ( q , ex_amq_fanout , "" ) ;
105+ string ex_source = GenerateExchangeName ( ) ;
106+ string ex_destination = GenerateExchangeName ( ) ;
107+
108+ await _channel . ExchangeDeclareAsync ( ex_source , ExchangeType . Fanout ) ;
109+ await _channel . ExchangeDeclareAsync ( ex_destination , ExchangeType . Fanout ) ;
110+
111+ await _channel . ExchangeBindAsync ( destination : ex_destination , source : ex_source , routingKey : "" ) ;
112+ await _channel . QueueBindAsync ( q , ex_destination , "" ) ;
113+ await _channel . QueueUnbindAsync ( q , ex_destination , "" ) ;
107114
108115 try
109116 {
110117 await CloseAndWaitForRecoveryAsync ( ) ;
111118 Assert . True ( _channel . IsOpen ) ;
112- await _channel . BasicPublishAsync ( ex_test , "" , _encoding . GetBytes ( "msg" ) ) ;
119+ await _channel . BasicPublishAsync ( ex_source , "" , _encoding . GetBytes ( "msg" ) ) ;
113120 await AssertMessageCountAsync ( q , 0 ) ;
114121 }
115122 finally
116123 {
117124 await WithTemporaryChannelAsync ( async ch =>
118125 {
119- await ch . ExchangeDeleteAsync ( ex_test ) ;
126+ await ch . ExchangeDeleteAsync ( ex_source ) ;
127+ await ch . ExchangeDeleteAsync ( ex_destination ) ;
120128 await ch . QueueDeleteAsync ( q ) ;
121129 } ) ;
122130 }
0 commit comments