Пример #1
0
        public async Task LeaveChannel()
        {
            TestMqServer server = new TestMqServer();

            server.Initialize(41203);
            server.Start();

            TmqClient client = new TmqClient();

            client.Connect("tmq://localhost:41203");

            TmqResponseCode joined = await client.Join("ch-1", true);

            Assert.Equal(TmqResponseCode.Ok, joined);

            TmqResponseCode left = await client.Leave("ch-1", false);

            Assert.Equal(TmqResponseCode.Ok, left);
            await Task.Delay(1000);

            Channel channel = server.Server.Channels.FirstOrDefault();

            Assert.NotNull(channel);

            List <ChannelClient> clients = channel.ClientsClone;

            Assert.Empty(clients);
        }