public void Consistent_hashing_router_must_select_destination_with_defined_hash_mapping()
{
ConsistentHashMapping hashMapping = msg =>
{
if (msg is Msg2)
{
var m2 = msg as Msg2;
return m2.Key;
}
return null;
};
var router2 =
Sys.ActorOf(new ConsistentHashingPool(1, null, null, null, hashMapping: hashMapping).Props(Props.Create<Echo>()), "router2");
router2.Tell(new Msg2("a", "A"));
var destinationA = ExpectMsg<IActorRef>();
router2.Tell(new ConsistentHashableEnvelope("AA", "a"));
ExpectMsg(destinationA);
router2.Tell(new Msg2(17, "A"));
var destinationB = ExpectMsg<IActorRef>();
router2.Tell(new ConsistentHashableEnvelope("BB", 17));
ExpectMsg(destinationB);
router2.Tell(new Msg2(new MsgKey("c"), "C"));
var destinationC = ExpectMsg<IActorRef>();
router2.Tell(new ConsistentHashableEnvelope("CC", new MsgKey("c")));
ExpectMsg(destinationC);
}