public void TestProtocol()
{
byte[] buffer = new byte[100];
NetPacketType type = NetPacketType.Kick;
byte firstParam = 0xAF;
byte secondParam = 0xFA;
int bytesPacked =
NetEncoding.PackProtocol(
buffer,
type,
firstParam,
secondParam);
byte firstParamRead;
byte secondParamRead;
bool success =
NetEncoding.ReadProtocol(
buffer,
bytesPacked,
out firstParamRead,
out secondParamRead);
Assert.AreEqual(0, buffer[bytesPacked]);
Assert.AreEqual(NetPacketType.Kick, NetEncoding.GetType(buffer));
Assert.AreEqual(true, success);
Assert.AreEqual(firstParam, firstParamRead);
Assert.AreEqual(secondParam, secondParamRead);
}