public void FindSystemMessage() { int id = MessagePacker.GetId <SceneMessage>(); Type type = MessagePacker.GetMessageType(id); Assert.That(type, Is.EqualTo(typeof(SceneMessage))); }
public void RegisterMessage() { MessagePacker.RegisterMessage <SomeRandomMessage>(); int id = MessagePacker.GetId <SomeRandomMessage>(); Type type = MessagePacker.GetMessageType(id); Assert.That(type, Is.EqualTo(typeof(SomeRandomMessage))); }
public void FindUnknownMessage() { // note that GetId<> will cause the weaver to register it // but GetId() will not int id = MessagePacker.GetId(typeof(SomeRandomMessageNotRegistered)); Assert.Throws <KeyNotFoundException>(() => { _ = MessagePacker.GetMessageType(id); }); }