Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions src/core/Akka.Tests/Event/EventBusSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using Akka.Actor;
using Akka.Event;
using Akka.TestKit;
Expand Down Expand Up @@ -146,33 +147,33 @@ public void EventBus_allow_publishing_with_empty_subscribers_list()
}

[Fact]
public void EventBus_publish_to_the_only_subscriber()
public async Task EventBus_publish_to_the_only_subscriber()
{
_bus.Subscribe(_subscriber, _classifier);
_bus.Publish(_evt);
ExpectMsg(_evt);
ExpectNoMsg(TimeSpan.FromSeconds(1));
await ExpectMsgAsync(_evt);
await ExpectNoMsgAsync(TimeSpan.FromSeconds(1));
_bus.Unsubscribe(_subscriber);
}

[Fact]
public void EventBus_publish_to_the_only_subscriber_multiple_times()
public async Task EventBus_publish_to_the_only_subscriber_multiple_times()
{
_bus.Subscribe(_subscriber, _classifier);
_bus.Publish(_evt);
_bus.Publish(_evt);
_bus.Publish(_evt);

ExpectMsg(_evt);
ExpectMsg(_evt);
ExpectMsg(_evt);
await ExpectMsgAsync(_evt);
await ExpectMsgAsync(_evt);
await ExpectMsgAsync(_evt);

ExpectNoMsg(TimeSpan.FromSeconds(1));
await ExpectNoMsgAsync(TimeSpan.FromSeconds(1));
_bus.Unsubscribe(_subscriber, _classifier);
}

[Fact]
public void EventBus_not_publish_event_to_unindented_subscribers()
public async Task EventBus_not_publish_event_to_unindented_subscribers()
{
var otherSubscriber = CreateSubscriber(TestActor);
var otherClassifier = typeof (int);
Expand All @@ -181,20 +182,20 @@ public void EventBus_not_publish_event_to_unindented_subscribers()
_bus.Subscribe(otherSubscriber, otherClassifier);
_bus.Publish(_evt);

ExpectMsg(_evt);
await ExpectMsgAsync(_evt);

_bus.Unsubscribe(_subscriber, _classifier);
_bus.Unsubscribe(otherSubscriber, otherClassifier);
ExpectNoMsg(TimeSpan.FromSeconds(1));
await ExpectNoMsgAsync(TimeSpan.FromSeconds(1));
}

[Fact]
public void EventBus_not_publish_event_to_former_subscriber()
public async Task EventBus_not_publish_event_to_former_subscriber()
{
_bus.Subscribe(_subscriber, _classifier);
_bus.Unsubscribe(_subscriber, _classifier);
_bus.Publish(_evt);
ExpectNoMsg(TimeSpan.FromSeconds(1));
await ExpectNoMsgAsync(TimeSpan.FromSeconds(1));
}

[Fact]
Expand Down