예제 #1
0
        public void PayloadReaderReadsNullTermString()
        {
            var msg = new ClientMsg <MsgClientChatEnter>(BuildStructMsg());

            string chatName = msg.ReadNullTermString();

            Assert.Equal(chatName, "Saxton Hell");
        }
예제 #2
0
        public void PayloadReaderReadsNullTermString()
        {
            var msg = new ClientMsg<MsgClientChatEnter>( BuildStructMsg() );

            string chatName = msg.ReadNullTermString();

            Assert.Equal( chatName, "Saxton Hell" );
        }
예제 #3
0
        public void PayloadReaderDoesNotOverflowPastNullTermString()
        {
            var msg = new ClientMsg <MsgClientChatEnter>(BuildStructMsg());

            string chatName = msg.ReadNullTermString();

            Assert.Equal(chatName, "Saxton Hell");

            byte nextByte = msg.ReadByte();
            char mByte    = (char)msg.ReadByte();

            // next byte should be a null
            Assert.Equal(nextByte, 0);
            // and the one after should be the beginning of a MessageObject
            Assert.Equal(mByte, 'M');
        }
예제 #4
0
        public void PayloadReaderDoesNotOverflowPastNullTermString()
        {
            var msg = new ClientMsg<MsgClientChatEnter>( BuildStructMsg() );

            string chatName = msg.ReadNullTermString();

            Assert.Equal( chatName, "Saxton Hell" );

            byte nextByte = msg.ReadByte();
            char mByte = (char)msg.ReadByte();

            // next byte should be a null
            Assert.Equal( nextByte, 0 );
            // and the one after should be the beginning of a MessageObject
            Assert.Equal( mByte, 'M' );
        }