Ejemplo n.º 1
0
        public void TestCustomRW()
        {
            QuestMessage message = new QuestMessage
            {
                quest = new MockQuest(100)
            };

            byte[]       data     = MessagePackingTest.PackToByteArray(message);
            QuestMessage unpacked = MessagePackingTest.UnpackFromByteArray <QuestMessage>(data);

            Assert.That(unpacked.quest.Id, Is.EqualTo(100));
        }
        public void TestWriteScriptableObject()
        {
            ScriptableObjectMessage message = new ScriptableObjectMessage
            {
                scriptableObject = ScriptableObject.CreateInstance <MyScriptableObject>()
            };

            message.scriptableObject.someData = 10;

            byte[] data = MessagePackingTest.PackToByteArray(message);

            ScriptableObjectMessage unpacked = MessagePackingTest.UnpackFromByteArray <ScriptableObjectMessage>(data);

            Assert.That(unpacked.scriptableObject, Is.Not.Null);
            Assert.That(unpacked.scriptableObject.someData, Is.EqualTo(10));
        }