Example #1
0
        public void RconPacketSuccessTest(bool useUTF8)
        {
            var packet = new RemoteConPacket(new byte[]
            {
                0x0A, 0x00, 0x00, 0x00, // Size
                0x02, 0x00, 0x00, 0x00, // Id
                0x03, 0x00, 0x00, 0x00, // Type
                0x00,
                0x00,
            }, useUTF8);

            Assert.Equal(2, packet.Id);
            Assert.Equal(10, packet.Size);
            Assert.Equal(RemoteConPacket.PacketType.Auth, packet.Type);
        }
Example #2
0
        public void RconPacketGetBytesTest(bool useUTF8)
        {
            var testBytes = new byte[]
            {
                0x0A, 0x00, 0x00, 0x00, // Size
                0x02, 0x00, 0x00, 0x00, // Id
                0x03, 0x00, 0x00, 0x00, // Type
                0x00,
                0x00,
            };
            var packet = new RemoteConPacket(2, RemoteConPacket.PacketType.Auth, "", useUTF8);

            var packetBytes = packet.GetBytes();

            for (var index = 0; index < testBytes.Length; index++)
            {
                Assert.Equal(testBytes[index], packetBytes[index]);
            }
        }