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

DistributedPubSubMediator_should_get_topics_after_simple_publish() public method

        public void DistributedPubSubMediator_should_get_topics_after_simple_publish()
        {
            DistributedPubSubMediator_should_receive_proper_UnsubscribeAck_message();

            Within(TimeSpan.FromSeconds(15), () =>
            {
                RunOn(() =>
                {
                    var s1 = new Subscribe("topic_a1", CreateChatUser("u14"));
                    Mediator.Tell(s1);
                    ExpectMsg<SubscribeAck>(x => x.Subscribe.Equals(s1));

                    var s2 = new Subscribe("topic_a1", CreateChatUser("u15"));
                    Mediator.Tell(s2);
                    ExpectMsg<SubscribeAck>(x => x.Subscribe.Equals(s2));

                    var s3 = new Subscribe("topic_a2", CreateChatUser("u16"));
                    Mediator.Tell(s3);
                    ExpectMsg<SubscribeAck>(x => x.Subscribe.Equals(s3));

                }, _first);

                RunOn(() =>
                {
                    var s3 = new Subscribe("topic_a1", CreateChatUser("u17"));
                    Mediator.Tell(s3);
                    ExpectMsg<SubscribeAck>(x => x.Subscribe.Equals(s3));

                }, _second);
                EnterBarrier("topics-registered");

                RunOn(() =>
                {
                    Mediator.Tell(GetTopics.Instance);
                    ExpectMsg<CurrentTopics>(
                        x => x.Topics.Contains("topic_a1") && x.Topics.Contains("topic_a2"));
                }, _first);

                RunOn(() =>
                {
                    // topics will eventually be replicated
                    AwaitAssert(() =>
                    {
                        Mediator.Tell(GetTopics.Instance);
                        var topics = ExpectMsg<CurrentTopics>().Topics;

                        Assert.True(topics.Contains("topic_a1"));
                        Assert.True(topics.Contains("topic_a2"));
                    });
                }, _second);
                EnterBarrier("after-get-topics");
            });
        }
    }