diff --git a/source/IntegrationTests/Behaviours/BehavioursTestBase.cs b/source/IntegrationTests/Behaviours/BehavioursTestBase.cs index 22d44f777..09a036412 100644 --- a/source/IntegrationTests/Behaviours/BehavioursTestBase.cs +++ b/source/IntegrationTests/Behaviours/BehavioursTestBase.cs @@ -362,16 +362,25 @@ protected async Task> WhenActorPeeksAllMessages(ActorNumber var timeoutAt = DateTime.UtcNow.AddMinutes(1); while (DateTime.UtcNow < timeoutAt) { + var thereWasNothingToPeek = true; foreach (var messageCategory in EnumerationType.GetAll()) { var peekResult = await WhenActorPeeksMessage(actorNumber, actorRole, documentFormat, messageCategory); if (peekResult is null) + { break; + } + thereWasNothingToPeek = false; peekResults.Add(peekResult); await WhenActorDequeuesMessage(peekResult.MessageId.Value, actorNumber, actorRole); } + + if (thereWasNothingToPeek) + { + break; + } } return peekResults;