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