Akka.Cluster.Tests.MultiNode.Routing.ClusterConsistentHashingGroupSpec.A_cluster_router_with_consistent_hashing_group_must_send_to_same_destinations_from_different_nodes C# (CSharp) Method

A_cluster_router_with_consistent_hashing_group_must_send_to_same_destinations_from_different_nodes() public method

        public void A_cluster_router_with_consistent_hashing_group_must_send_to_same_destinations_from_different_nodes()
        {
            Sys.ActorOf(Props.Create<ClusterConsistentHashingGroupSpecConfig.Destination>(), "dest");
            AwaitClusterUp(_config.First, _config.Second, _config.Third);
            EnterBarrier("after-1");

            ConsistentHashMapping hashMapping = msg =>
            {
                if (msg is string) return msg;
                return null;
            };

            var paths = new List<string> { "/user/dest" };
            var router =
                Sys.ActorOf(
                    new ClusterRouterGroup(new ConsistentHashingGroup(paths).WithHashMapping(hashMapping),
                        new ClusterRouterGroupSettings(10, true, null, ImmutableHashSet.Create(paths.ToArray())))
                        .Props(), "router");

            // it may take some time until router receives cluster member events
            AwaitAssert(() =>
            {
                var members = CurrentRoutees(router).Members;
                members.Count().ShouldBe(3);
            });
            var keys = new[] { "A", "B", "C", "D", "E", "F", "G" };
            foreach (var key in Enumerable.Range(1, 10).SelectMany(i => keys))
            {
                router.Tell(key, TestActor);
            }
            EnterBarrier("messages-sent");
            router.Tell(new Broadcast(new ClusterConsistentHashingGroupSpecConfig.Get()));
            var a = ExpectMsg<ClusterConsistentHashingGroupSpecConfig.Collected>().Messages;
            var b = ExpectMsg<ClusterConsistentHashingGroupSpecConfig.Collected>().Messages;
            var c = ExpectMsg<ClusterConsistentHashingGroupSpecConfig.Collected>().Messages;

            a.Intersect(b).Count().ShouldBe(0);
            a.Intersect(c).Count().ShouldBe(0);
            b.Intersect(c).Count().ShouldBe(0);

            (a.Count + b.Count + c.Count).ShouldBe(keys.Length);
            EnterBarrier("after-2");
        }
    }