diff --git a/publisher/src/LeanCode.Pipe.TestClient/LeanPipeSubscription.cs b/publisher/src/LeanCode.Pipe.TestClient/LeanPipeSubscription.cs index 765202c..674b301 100644 --- a/publisher/src/LeanCode.Pipe.TestClient/LeanPipeSubscription.cs +++ b/publisher/src/LeanCode.Pipe.TestClient/LeanPipeSubscription.cs @@ -8,10 +8,14 @@ public class LeanPipeSubscription private readonly object notificationMutex = new(); private TaskCompletionSource nextMessageAwaiter = new(TaskCreationOptions.RunContinuationsAsynchronously); - private readonly ConcurrentStack receivedNotifications = new(); + private readonly ConcurrentQueue receivedNotifications = new(); public ITopic Topic { get; private init; } public Guid? SubscriptionId { get; private set; } + + /// + /// A FIFO collection of received notifications. + /// public IReadOnlyCollection ReceivedNotifications => receivedNotifications; public LeanPipeSubscription(ITopic topic, Guid? subscriptionId) @@ -32,7 +36,7 @@ public void Unsubscribe() public void AddNotification(object notification) { - receivedNotifications.Push(notification); + receivedNotifications.Enqueue(notification); lock (notificationMutex) { diff --git a/publisher/src/LeanCode.Pipe.TestClient/LeanPipeTestClientExtensions.cs b/publisher/src/LeanCode.Pipe.TestClient/LeanPipeTestClientExtensions.cs index dc3953f..33d954d 100644 --- a/publisher/src/LeanCode.Pipe.TestClient/LeanPipeTestClientExtensions.cs +++ b/publisher/src/LeanCode.Pipe.TestClient/LeanPipeTestClientExtensions.cs @@ -74,6 +74,7 @@ public static async Task WaitForNextNotificationOn( ); } + /// A FIFO collection of received notifications on topic instance. public static IReadOnlyCollection NotificationsOn( this LeanPipeTestClient client, TTopic topic