Exemplo n.º 1
0
        public void RequestChannelList()
        {
            var cs         = provider.GetConnections(GablarskiProtocol.Instance);
            var connection = new ConnectionBuffer(cs.Item1);

            connection.SendAsync(new RequestChannelListMessage());

            Message message = connection.DequeueMessage();

            Assert.IsInstanceOf <ChannelListMessage> (message);
            var list = (ChannelListMessage)message;

            Assert.AreEqual(GenericResult.Success, list.Result);
            Assert.IsNotNull(list.Channels);
            CollectionAssert.IsNotEmpty(list.Channels);
        }
Exemplo n.º 2
0
        public void OldVersionReject()
        {
            var cs         = provider.GetConnections(GablarskiProtocol.Instance);
            var connection = new ConnectionBuffer(cs.Item1);

            connection.SendAsync(new ConnectMessage {
                ProtocolVersion = 0
            });

            Message message = connection.DequeueMessage();

            Assert.IsInstanceOf <ConnectionRejectedMessage> (message);
            var rejected = (ConnectionRejectedMessage)message;

            Assert.AreEqual(ConnectionRejectedReason.IncompatibleVersion, rejected.Reason);
        }