Akka.Cluster.Sharding.Tests.ClusterShardingSpec.ClusterSharding_should_be_easy_to_use_with_extensions C# (CSharp) Метод

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

private ClusterSharding_should_be_easy_to_use_with_extensions ( ) : void
Результат void
        public void ClusterSharding_should_be_easy_to_use_with_extensions()
        {
            ClusterSharding_should_rebalance_to_nodes_with_less_shards();

            Within(TimeSpan.FromSeconds(50), () =>
            {
                RunOn(() =>
                {
                    //#counter-start
                    ClusterSharding.Get(Sys).Start(
                        typeName: "Counter",
                        entityProps: Props.Create<Counter>(),
                        settings: ClusterShardingSettings.Create(Sys),
                        idExtractor: Counter.ExtractEntityId,
                        shardResolver: Counter.ExtractShardId);

                    //#counter-start
                    ClusterSharding.Get(Sys).Start(
                        typeName: "AnotherCounter",
                        entityProps: Props.Create<Counter>(),
                        settings: ClusterShardingSettings.Create(Sys),
                        idExtractor: Counter.ExtractEntityId,
                        shardResolver: Counter.ExtractShardId);
                }, _third, _fourth, _fifth, _sixth);
                EnterBarrier("extension-started");

                RunOn(() =>
                {
                    //#counter-usage
                    var counterRegion = ClusterSharding.Get(Sys).ShardRegion("Counter");
                    counterRegion.Tell(new Counter.Get(123));
                    ExpectMsg(0);

                    counterRegion.Tell(new Counter.EntityEnvelope(123, Counter.Increment.Instance));
                    counterRegion.Tell(new Counter.Get(123));
                    ExpectMsg(1);

                    //#counter-usage
                    var anotherCounterRegion = ClusterSharding.Get(Sys).ShardRegion("AnotherCounter");
                    anotherCounterRegion.Tell(new Counter.EntityEnvelope(123, Counter.Decrement.Instance));
                    anotherCounterRegion.Tell(new Counter.Get(123));
                    ExpectMsg(-1);
                }, _fifth);
                EnterBarrier("extension-used");

                // sixth is a frontend node, i.e. proxy only
                RunOn(() =>
                {
                    for (int i = 1000; i <= 1010; i++)
                    {
                        ClusterSharding.Get(Sys).ShardRegion("Counter").Tell(new Counter.EntityEnvelope(i, Counter.Increment.Instance));
                        ClusterSharding.Get(Sys).ShardRegion("Counter").Tell(new Counter.Get(i));
                        ExpectMsg(1);
                        Assert.NotEqual(Cluster.SelfAddress, LastSender.Path.Address);
                    }
                }, _sixth);
                EnterBarrier("after-10");
            });
        }