@@ -84,16 +84,9 @@ public abstract class IntegrationFixture : IAsyncLifetime
84
84
public static readonly TimeSpan RecoveryInterval = TimeSpan . FromSeconds ( 2 ) ;
85
85
public static readonly TimeSpan TestTimeout = TimeSpan . FromSeconds ( 5 ) ;
86
86
public static readonly TimeSpan RequestedConnectionTimeout = TimeSpan . FromSeconds ( 1 ) ;
87
- public static readonly Random S_Random ;
88
87
89
88
static IntegrationFixture ( )
90
89
{
91
-
92
- #if NET
93
- S_Random = Random . Shared ;
94
- #else
95
- S_Random = new Random ( ) ;
96
- #endif
97
90
s_isRunningInCI = InitIsRunningInCI ( ) ;
98
91
s_isVerbose = InitIsVerbose ( ) ;
99
92
@@ -450,12 +443,19 @@ protected async Task WithTemporaryChannelAsync(Func<IChannel, Task> action)
450
443
451
444
protected string GenerateExchangeName ( )
452
445
{
453
- return $ "{ _testDisplayName } -exchange-{ Guid . NewGuid ( ) } ";
446
+ return $ "{ _testDisplayName } -exchange-{ Now } - { GenerateShortUuid ( ) } ";
454
447
}
455
448
456
- protected string GenerateQueueName ( )
449
+ protected string GenerateQueueName ( bool useGuid = false )
457
450
{
458
- return $ "{ _testDisplayName } -queue-{ Guid . NewGuid ( ) } ";
451
+ if ( useGuid )
452
+ {
453
+ return $ "{ _testDisplayName } -queue-{ Now } -{ Guid . NewGuid ( ) } ";
454
+ }
455
+ else
456
+ {
457
+ return $ "{ _testDisplayName } -queue-{ Now } -{ GenerateShortUuid ( ) } ";
458
+ }
459
459
}
460
460
461
461
protected Task WithTemporaryNonExclusiveQueueAsync ( Func < IChannel , string , Task > action )
@@ -540,7 +540,7 @@ protected ConnectionFactory CreateConnectionFactory(
540
540
{
541
541
return new ConnectionFactory
542
542
{
543
- ClientProvidedName = $ "{ _testDisplayName } :{ Util . Now } :{ GetConnectionIdx ( ) } ",
543
+ ClientProvidedName = $ "{ _testDisplayName } :{ Now } :{ GetConnectionIdx ( ) } ",
544
544
ContinuationTimeout = WaitSpan ,
545
545
HandshakeContinuationTimeout = WaitSpan ,
546
546
ConsumerDispatchConcurrency = consumerDispatchConcurrency
@@ -631,10 +631,16 @@ protected static string GetUniqueString(ushort length)
631
631
protected static byte [ ] GetRandomBody ( ushort size = 1024 )
632
632
{
633
633
byte [ ] body = new byte [ size ] ;
634
- S_Random . NextBytes ( body ) ;
634
+ Util . S_Random . NextBytes ( body ) ;
635
635
return body ;
636
636
}
637
637
638
+ protected static string Now => Util . Now ;
639
+
640
+ protected static string GenerateShortUuid ( ) => Util . GenerateShortUuid ( ) ;
641
+
642
+ protected static int RandomNext ( int min , int max ) => Util . S_Random . Next ( min , max ) ;
643
+
638
644
protected static Task WaitForRecoveryAsync ( IConnection conn )
639
645
{
640
646
TaskCompletionSource < bool > tcs = PrepareForRecovery ( ( AutorecoveringConnection ) conn ) ;
0 commit comments