Tests: MessagePacking.GetId<T>

This commit is contained in:
vis2k 2022-01-06 20:06:32 +08:00
parent 35be99c5d9
commit 7e0f649f59

View File

@ -1,5 +1,8 @@
using System; using System;
using Mirror.Tests.MessageTests;
using NUnit.Framework; using NUnit.Framework;
using UnityEngine;
namespace Mirror.Tests namespace Mirror.Tests
{ {
[TestFixture] [TestFixture]
@ -34,6 +37,16 @@ public static T UnpackFromByteArray<T>(byte[] data)
} }
} }
// message id is generated from message.FullName.
// should be consistent across all platforms.
[Test]
public void GetId()
{
// "Mirror.Tests.MessageTests.TestMessage"
Debug.Log(typeof(TestMessage).FullName);
Assert.That(MessagePacking.GetId<TestMessage>(), Is.EqualTo(0x8706));
}
[Test] [Test]
public void TestPacking() public void TestPacking()
{ {