public void Priority_mailbox_keeps_ordering_with_many_priority_values()
{
var actor = Sys.ActorOf(EchoActor.Props(this).WithMailbox("int-prio-mailbox"), "echo");
//pause mailbox until all messages have been told
actor.Tell(Suspend.Instance);
AwaitCondition(()=> ((LocalActorRef)actor).Cell.Mailbox.IsSuspended);
// creates 50 messages with values spanning from Int32.MinValue to Int32.MaxValue
var values = new int[50];
var increment = (int)(UInt32.MaxValue / values.Length);
for (var i = 0; i < values.Length; i++)
values[i] = Int32.MinValue + increment * i;
// tell the actor in reverse order
foreach (var value in values.Reverse())
{
actor.Tell(value);
actor.Tell(value);
actor.Tell(value);
}
//resume mailbox, this prevents the mailbox from running to early
actor.Tell(new Resume(null));
// expect the messages in the correct order
foreach (var value in values)
{
ExpectMsg(value);
ExpectMsg(value);
ExpectMsg(value);
}
ExpectNoMsg(TimeSpan.FromSeconds(0.3));
}
}