42
42
43
43
using NUnit . Framework ;
44
44
45
- using RabbitMQ . Client . Framing ;
46
45
using RabbitMQ . Client . Framing . Impl ;
47
46
48
47
namespace RabbitMQ . Client . Unit
49
48
{
50
-
51
49
public class IntegrationFixture
52
50
{
53
51
internal IConnectionFactory ConnFactory ;
@@ -56,6 +54,12 @@ public class IntegrationFixture
56
54
57
55
internal Encoding encoding = new UTF8Encoding ( ) ;
58
56
public static TimeSpan RECOVERY_INTERVAL = TimeSpan . FromSeconds ( 2 ) ;
57
+ protected readonly string _testDisplayName ;
58
+
59
+ public IntegrationFixture ( )
60
+ {
61
+ _testDisplayName = TestContext . CurrentContext . Test . FullName ;
62
+ }
59
63
60
64
[ SetUp ]
61
65
public virtual void Init ( )
@@ -72,6 +76,7 @@ public void Dispose()
72
76
{
73
77
Model . Close ( ) ;
74
78
}
79
+
75
80
if ( Conn . IsOpen )
76
81
{
77
82
Conn . Close ( ) ;
@@ -106,7 +111,7 @@ internal AutorecoveringConnection CreateAutorecoveringConnection(TimeSpan interv
106
111
AutomaticRecoveryEnabled = true ,
107
112
NetworkRecoveryInterval = interval
108
113
} ;
109
- return ( AutorecoveringConnection ) cf . CreateConnection ( $ "UNIT_CONN :{ Guid . NewGuid ( ) } ") ;
114
+ return ( AutorecoveringConnection ) cf . CreateConnection ( $ "{ _testDisplayName } :{ Guid . NewGuid ( ) } ") ;
110
115
}
111
116
112
117
internal AutorecoveringConnection CreateAutorecoveringConnection ( TimeSpan interval , IList < string > hostnames )
@@ -119,7 +124,7 @@ internal AutorecoveringConnection CreateAutorecoveringConnection(TimeSpan interv
119
124
RequestedConnectionTimeout = TimeSpan . FromSeconds ( 1 ) ,
120
125
NetworkRecoveryInterval = interval
121
126
} ;
122
- return ( AutorecoveringConnection ) cf . CreateConnection ( hostnames , $ "UNIT_CONN :{ Guid . NewGuid ( ) } ") ;
127
+ return ( AutorecoveringConnection ) cf . CreateConnection ( hostnames , $ "{ _testDisplayName } :{ Guid . NewGuid ( ) } ") ;
123
128
}
124
129
125
130
internal AutorecoveringConnection CreateAutorecoveringConnection ( IList < AmqpTcpEndpoint > endpoints )
@@ -132,7 +137,7 @@ internal AutorecoveringConnection CreateAutorecoveringConnection(IList<AmqpTcpEn
132
137
RequestedConnectionTimeout = TimeSpan . FromSeconds ( 1 ) ,
133
138
NetworkRecoveryInterval = RECOVERY_INTERVAL
134
139
} ;
135
- return ( AutorecoveringConnection ) cf . CreateConnection ( endpoints , $ "UNIT_CONN :{ Guid . NewGuid ( ) } ") ;
140
+ return ( AutorecoveringConnection ) cf . CreateConnection ( endpoints , $ "{ _testDisplayName } :{ Guid . NewGuid ( ) } ") ;
136
141
}
137
142
138
143
internal AutorecoveringConnection CreateAutorecoveringConnectionWithTopologyRecoveryDisabled ( )
@@ -143,7 +148,7 @@ internal AutorecoveringConnection CreateAutorecoveringConnectionWithTopologyReco
143
148
TopologyRecoveryEnabled = false ,
144
149
NetworkRecoveryInterval = RECOVERY_INTERVAL
145
150
} ;
146
- return ( AutorecoveringConnection ) cf . CreateConnection ( $ "UNIT_CONN :{ Guid . NewGuid ( ) } ") ;
151
+ return ( AutorecoveringConnection ) cf . CreateConnection ( $ "{ _testDisplayName } :{ Guid . NewGuid ( ) } ") ;
147
152
}
148
153
149
154
internal IConnection CreateNonRecoveringConnection ( )
@@ -153,7 +158,7 @@ internal IConnection CreateNonRecoveringConnection()
153
158
AutomaticRecoveryEnabled = false ,
154
159
TopologyRecoveryEnabled = false
155
160
} ;
156
- return cf . CreateConnection ( $ "UNIT_CONN :{ Guid . NewGuid ( ) } ") ;
161
+ return cf . CreateConnection ( $ "{ _testDisplayName } :{ Guid . NewGuid ( ) } ") ;
157
162
}
158
163
159
164
internal IConnection CreateConnectionWithContinuationTimeout ( bool automaticRecoveryEnabled , TimeSpan continuationTimeout )
@@ -163,7 +168,7 @@ internal IConnection CreateConnectionWithContinuationTimeout(bool automaticRecov
163
168
AutomaticRecoveryEnabled = automaticRecoveryEnabled ,
164
169
ContinuationTimeout = continuationTimeout
165
170
} ;
166
- return cf . CreateConnection ( $ "UNIT_CONN :{ Guid . NewGuid ( ) } ") ;
171
+ return cf . CreateConnection ( $ "{ _testDisplayName } :{ Guid . NewGuid ( ) } ") ;
167
172
}
168
173
169
174
//
@@ -177,7 +182,7 @@ internal void WithTemporaryAutorecoveringConnection(Action<AutorecoveringConnect
177
182
AutomaticRecoveryEnabled = true
178
183
} ;
179
184
180
- var connection = ( AutorecoveringConnection ) factory . CreateConnection ( $ "UNIT_CONN :{ Guid . NewGuid ( ) } ") ;
185
+ var connection = ( AutorecoveringConnection ) factory . CreateConnection ( $ "{ _testDisplayName } :{ Guid . NewGuid ( ) } ") ;
181
186
try
182
187
{
183
188
action ( connection ) ;
0 commit comments