コード例 #1
0
        public void TestOutgoingMessageRawBytes()
        {
            // Make sure that SetRawBytes resets the buffer correctly.
            // Write 8 bytes (an int and float) then call SetRawBytes with 4 bytes
            var msg = new OutgoingMessage();

            msg.WriteInt32(42);
            msg.WriteFloat32(1.0f);

            var data = new byte[] { 1, 2, 3, 4 };

            msg.SetRawBytes(data);

            var result = msg.ToByteArray();

            Assert.AreEqual(data, result);
        }