Akka.Cluster.Tools.Tests.MultiNode.PublishSubscribe.DistributedPubSubMediatorSpec.DistributedPubSubMediator_should_publish_to_topic C# (CSharp) Method

DistributedPubSubMediator_should_publish_to_topic() public method

        public void DistributedPubSubMediator_should_publish_to_topic()
        {
            DistributedPubSubMediator_should_publish();

            Within(TimeSpan.FromSeconds(15), () =>
            {
                RunOn(() =>
                {
                    var s8 = new Subscribe("topic1", CreateChatUser("u8"));
                    Mediator.Tell(s8);
                    ExpectMsg<SubscribeAck>(x => x.Subscribe.Equals(s8));
                    var s9 = new Subscribe("topic1", CreateChatUser("u9"));
                    Mediator.Tell(s9);
                    ExpectMsg<SubscribeAck>(x => x.Subscribe.Equals(s9));
                }, _first);

                RunOn(() =>
                {
                    var s10 = new Subscribe("topic1", CreateChatUser("u10"));
                    Mediator.Tell(s10);
                    ExpectMsg<SubscribeAck>(x => x.Subscribe.Equals(s10));
                }, _second);

                // one topic on two nodes
                AwaitCount(8);
                EnterBarrier("topic1-registered");

                RunOn(() =>
                {
                    ChatUser("u5").Tell(new Shout("topic1", "hello all"));
                }, _third);

                RunOn(() =>
                {
                    var names = ReceiveWhile(x => "hello all".Equals(x) ? LastSender.Path.Name : null, msgs: 2);
                    Assert.True(names.All(x => x == "u8" || x == "u9"));
                }, _first);

                RunOn(() =>
                {
                    ExpectMsg("hello all");
                    Assert.Equal("u10", LastSender.Path.Name);
                }, _second);

                RunOn(() =>
                {
                    ExpectNoMsg(TimeSpan.FromSeconds(2));
                }, _third);
                EnterBarrier("after-7");
            });
        }