示例#1
0
        public void FindSystemMessage()
        {
            int  id   = MessagePacker.GetId <SceneMessage>();
            Type type = MessagePacker.GetMessageType(id);

            Assert.That(type, Is.EqualTo(typeof(SceneMessage)));
        }
示例#2
0
        public void RegisterMessage()
        {
            MessagePacker.RegisterMessage <SomeRandomMessage>();

            int id = MessagePacker.GetId <SomeRandomMessage>();

            Type type = MessagePacker.GetMessageType(id);

            Assert.That(type, Is.EqualTo(typeof(SomeRandomMessage)));
        }
示例#3
0
        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);
            });
        }