Example #1
0
        public void Join()
        {
            string nickname = "Foo";
            var    msg      = new JoinMessage {
                Nickname = nickname
            };

            msg.WritePayload(null, writer);
            long length = stream.Position;

            stream.Position = 0;

            msg = new JoinMessage();
            msg.ReadPayload(null, reader);

            Assert.AreEqual(length, stream.Position);
            Assert.AreEqual(nickname, msg.Nickname);
        }
Example #2
0
        public void JoinWithServerPassword()
        {
            string nickname = "Foo";
            string password = "******";
            var    msg      = new JoinMessage {
                Nickname = nickname, ServerPassword = password
            };

            Assert.AreEqual(nickname, msg.Nickname);
            Assert.AreEqual(password, msg.ServerPassword);
            msg.WritePayload(null, writer);
            long length = stream.Position;

            stream.Position = 0;

            msg = new JoinMessage();
            msg.ReadPayload(null, reader);

            Assert.AreEqual(length, stream.Position);
            Assert.AreEqual(nickname, msg.Nickname);
            Assert.AreEqual(password, msg.ServerPassword);
        }