Closed SeanFeldman closed 5 years ago
To receive, TestUtility has to continue until one of the conditions is no longer fullfilled:
Received messages >= messageCount
receiveAttempts >= TestConstants.MaxAttemptsCount
stopwatch.Elapsed >= timeout
The original code does OR between receive attempts check and timeout, rather than AND.
while (messagesToReturn.Count < messageCount && (receiveAttempts++ < TestConstants.MaxAttemptsCount || stopwatch.Elapsed < timeout))
Meaning if the number of attempts is not exceeded, but timeout elapsed (or the opposite), the loop will continue running. The correct behaviour should be AND between all 3 conditions.
To receive, TestUtility has to continue until one of the conditions is no longer fullfilled:
Received messages >= messageCount
ORreceiveAttempts >= TestConstants.MaxAttemptsCount
ORstopwatch.Elapsed >= timeout
The original code does OR between receive attempts check and timeout, rather than AND.
Meaning if the number of attempts is not exceeded, but timeout elapsed (or the opposite), the loop will continue running. The correct behaviour should be AND between all 3 conditions.