Skip to content
Merged
Changes from 1 commit
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
36 changes: 18 additions & 18 deletions src/core/Akka.Tests/Dispatch/ActorMailboxSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,15 @@ public class BoundedQueueReportingActor : MailboxReportingActor, IRequiresMessag

}

private IMessageQueue CheckMailBoxType(Props props, string name, IEnumerable<Type> expectedMailboxTypes)
private async Task<IMessageQueue> CheckMailBoxType(Props props, string name, IEnumerable<Type> expectedMailboxTypes)
{
var actor = Sys.ActorOf(props, name);
actor.Tell("ping");

var mailbox = ExpectMsg<IMessageQueue>(msg =>
var mailbox = await ExpectMsgAsync<IMessageQueue>(msg =>
{
expectedMailboxTypes.ForEach(type => Assert.True(type.IsAssignableFrom(msg.GetType()),
String.Format(CultureInfo.InvariantCulture, "Type [{0}] is not assignable to [{1}]", msg.GetType(), type)));
string.Format(CultureInfo.InvariantCulture, "Type [{0}] is not assignable to [{1}]", msg.GetType(), type)));
});

return mailbox;
Expand All @@ -124,52 +124,52 @@ private IMessageQueue CheckMailBoxType(Props props, string name, IEnumerable<Typ
#region Test cases

[Fact(DisplayName = @"Actors get an unbounded mailbox by default")]
public void Actors_get_unbounded_mailbox_by_default()
public async Task Actors_get_unbounded_mailbox_by_default()
{
CheckMailBoxType(Props.Create<MailboxReportingActor>(), "default-default", new[] { typeof(UnboundedMessageQueue) });
await CheckMailBoxType(Props.Create<MailboxReportingActor>(), "default-default", new[] { typeof(UnboundedMessageQueue) });
}

[Fact(DisplayName = @"Actors get an unbounded deque message queue when it is only configured on the props")]
public void Actors_get_unbounded_dequeue_mailbox_when_configured_in_properties()
public async Task Actors_get_unbounded_dequeue_mailbox_when_configured_in_properties()
{
CheckMailBoxType(Props.Create<MailboxReportingActor>().WithMailbox("unbounded-mailbox"),
await CheckMailBoxType(Props.Create<MailboxReportingActor>().WithMailbox("unbounded-mailbox"),
"default-override-from-props", new[] { typeof(UnboundedDequeMessageQueue) });
}

[Fact(DisplayName = @"Actors get an unbounded deque message queue when it's only mixed with Stash")]
public void Actors_get_unbounded_mailbox_when_configured_with_stash_only()
public async Task Actors_get_unbounded_mailbox_when_configured_with_stash_only()
{
CheckMailBoxType(Props.Create<StashMailboxReportingActor>(),
await CheckMailBoxType(Props.Create<StashMailboxReportingActor>(),
"default-override-from-stash", new[] { typeof(UnboundedDequeMessageQueue) });

CheckMailBoxType(Props.Create(() => new StashMailboxReportingActor()),
await CheckMailBoxType(Props.Create(() => new StashMailboxReportingActor()),
"default-override-from-stash2", new[] { typeof(UnboundedDequeMessageQueue) });

CheckMailBoxType(Props.Create<StashMailboxWithParamsReportingActor>(10, "foo"),
await CheckMailBoxType(Props.Create<StashMailboxWithParamsReportingActor>(10, "foo"),
"default-override-from-stash3", new[] { typeof(UnboundedDequeMessageQueue) });

CheckMailBoxType(Props.Create(() => new StashMailboxWithParamsReportingActor(10, "foo")),
await CheckMailBoxType(Props.Create(() => new StashMailboxWithParamsReportingActor(10, "foo")),
"default-override-from-stash4", new[] { typeof(UnboundedDequeMessageQueue) });
}

[Fact(DisplayName = "Actors get an unbounded deque message queue when it's configured as mailbox")]
public void Actors_get_unbounded_dequeue_message_queue_when_configured_as_mailbox()
public async Task Actors_get_unbounded_dequeue_message_queue_when_configured_as_mailbox()
{
CheckMailBoxType(Props.Create<MailboxReportingActor>(), "default-unboundeded-deque",
await CheckMailBoxType(Props.Create<MailboxReportingActor>(), "default-unboundeded-deque",
new[] { typeof(UnboundedDequeMessageQueue) });
}

[Fact(DisplayName = "Actor get an unbounded message queue when defined in dispatcher")]
public void Actor_gets_configured_mailbox_from_dispatcher()
public async Task Actor_gets_configured_mailbox_from_dispatcher()
{
CheckMailBoxType(Props.Create<MailboxReportingActor>(), "unbounded-default",
await CheckMailBoxType(Props.Create<MailboxReportingActor>(), "unbounded-default",
new[] { typeof(UnboundedDequeMessageQueue) });
}

[Fact(DisplayName = "get an unbounded message queue with a task dispatcher")]
public void Actors_gets_unbounded_mailbox_with_task_dispatcher()
public async Task Actors_gets_unbounded_mailbox_with_task_dispatcher()
{
CheckMailBoxType(Props.Create<MailboxReportingActor>().WithDispatcher("task-dispatcher"),
await CheckMailBoxType(Props.Create<MailboxReportingActor>().WithDispatcher("task-dispatcher"),
"unbounded-tasks", new[] { typeof(UnboundedMessageQueue) });
}

Expand Down