Beispiel #1
0
        public void TestForcedSubscriberName()
        {
            using (var conn = Config.GetUnsecuredConnection(allowAdmin: true, open: true, waitForOpen: true))
                using (var sub = new RedisSubscriberConnection(conn.Host, conn.Port))
                {
                    var    task = sub.Subscribe("foo", delegate { });
                    string name = Config.CreateUniqueName();
                    sub.Name = name;
                    sub.SetServerVersion(new Version("2.6.9"), ServerType.Master);
                    sub.Wait(sub.Open());
                    sub.Wait(task);
                    Assert.AreEqual(1, sub.SubscriptionCount);

                    if (!conn.Features.ClientName)
                    {
                        Assert.Inconclusive();
                    }
                    var clients = conn.Wait(conn.Server.ListClients()).Where(c => c.Name == name).ToList();
                    Assert.AreEqual(1, clients.Count, "number of clients");
                }
        }