From e96602c5c5ec0b83f445462cac3d0a777ba2c6c4 Mon Sep 17 00:00:00 2001 From: Roger Johansson Date: Sun, 10 Dec 2023 20:17:50 +0100 Subject: [PATCH] . --- tests/Proto.Actor.Tests/EventStreamTests.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/Proto.Actor.Tests/EventStreamTests.cs b/tests/Proto.Actor.Tests/EventStreamTests.cs index 6daa2913fe..1970a4948d 100644 --- a/tests/Proto.Actor.Tests/EventStreamTests.cs +++ b/tests/Proto.Actor.Tests/EventStreamTests.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.Threading; using System.Threading.Tasks; using Proto.Mailbox; using Xunit; @@ -17,6 +18,9 @@ public async Task EventStream_CanSubscribeToSpecificEventTypes() eventStream.Subscribe(theString => received = theString); eventStream.Publish("hello"); + + await Task.Delay(1000); + Assert.Equal("hello", received); } @@ -32,6 +36,9 @@ public async Task EventStream_CanSubscribeToAllEventTypes() eventStream.Publish("hello"); eventStream.Publish(1); eventStream.Publish(true); + + await Task.Delay(1000); + Assert.Equal(3, receivedEvents.Count); } @@ -46,6 +53,9 @@ public async Task EventStream_CanUnsubscribeFromEvents() eventStream.Publish("first message"); subscription.Unsubscribe(); eventStream.Publish("second message"); + + await Task.Delay(1000); + Assert.Single(receivedEvents); } @@ -59,6 +69,9 @@ public async Task EventStream_OnlyReceiveSubscribedToEventTypes() var eventsReceived = new List(); eventStream.Subscribe(@event => eventsReceived.Add(@event)); eventStream.Publish("not an int"); + + await Task.Delay(1000); + Assert.Empty(eventsReceived); } @@ -79,5 +92,6 @@ public async Task EventStream_CanSubscribeToSpecificEventTypes_Async() ); eventStream.Publish("hello"); + await Task.Delay(1000); } } \ No newline at end of file