Akka.Tests.Routing.ConsistentHashingRouterSpec.Consistent_hashing_group_router_must_select_destination_with_defined_hash_mapping C# (CSharp) Метод

Consistent_hashing_group_router_must_select_destination_with_defined_hash_mapping() приватный Метод

        public void Consistent_hashing_group_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 router4 =
                Sys.ActorOf(Props.Empty.WithRouter(new ConsistentHashingGroup(new[]{c},hashMapping: hashMapping)), "router4");

            router4.Tell(new Msg2("a", "A"));
            var destinationA = ExpectMsg<IActorRef>();
            router4.Tell(new ConsistentHashableEnvelope("AA", "a"));
            ExpectMsg(destinationA);

            router4.Tell(new Msg2(17, "A"));
            var destinationB = ExpectMsg<IActorRef>();
            router4.Tell(new ConsistentHashableEnvelope("BB", 17));
            ExpectMsg(destinationB);

            router4.Tell(new Msg2(new MsgKey("c"), "C"));
            var destinationC = ExpectMsg<IActorRef>();
            router4.Tell(new ConsistentHashableEnvelope("CC", new MsgKey("c")));
            ExpectMsg(destinationC);
        }