Skip to content

Commit c3e4b22

Browse files
committed
* No need for random data, just different data.
1 parent b13957a commit c3e4b22

File tree

1 file changed

+5
-19
lines changed

1 file changed

+5
-19
lines changed

projects/Test/Integration/TestAsyncConsumer.cs

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public async Task TestBasicRoundtripConcurrent()
5858
QueueDeclareOk q = await _channel.QueueDeclareAsync();
5959

6060
const int length = 4096;
61-
(byte[] body1, byte[] body2) = await GenerateTwoBodies(length);
61+
(byte[] body1, byte[] body2) = GenerateTwoBodies(length);
6262

6363
await _channel.BasicPublishAsync("", q.QueueName, body1);
6464
await _channel.BasicPublishAsync("", q.QueueName, body2);
@@ -152,7 +152,7 @@ public async Task TestBasicRoundtripConcurrentManyMessages()
152152
const int length = 512;
153153
string queueName = GenerateQueueName();
154154

155-
(byte[] body1, byte[] body2) = await GenerateTwoBodies(length);
155+
(byte[] body1, byte[] body2) = GenerateTwoBodies(length);
156156

157157
var publish1SyncSource = new TaskCompletionSource<bool>(TaskCreationOptions.RunContinuationsAsynchronously);
158158
var publish2SyncSource = new TaskCompletionSource<bool>(TaskCreationOptions.RunContinuationsAsynchronously);
@@ -693,24 +693,10 @@ private static bool ByteArraysEqual(ReadOnlySpan<byte> a1, ReadOnlySpan<byte> a2
693693
return a1.SequenceEqual(a2);
694694
}
695695

696-
private static async Task<(byte[] body1, byte[] body2)> GenerateTwoBodies(ushort length)
696+
private static (byte[] body1, byte[] body2) GenerateTwoBodies(ushort length)
697697
{
698-
DateTime start = DateTime.Now;
699-
byte[] body1 = GetRandomBody(length);
700-
byte[] body2 = GetRandomBody(length);
701-
while (ByteArraysEqual(body1, body2))
702-
{
703-
body2 = GetRandomBody(length);
704-
if (DateTime.Now - start > ShortSpan)
705-
{
706-
Assert.Fail($"could not generate two different random sets of data within {ShortSpan}");
707-
}
708-
else
709-
{
710-
await Task.Delay(500);
711-
}
712-
}
713-
698+
byte[] body1 = _encoding.GetBytes(new string('x', length));
699+
byte[] body2 = _encoding.GetBytes(new string('y', length));
714700
return (body1, body2);
715701
}
716702

0 commit comments

Comments
 (0)