public void TestDeserializeSingletonStruct() { var bytes = new byte[] { 7 }; var byteObj = SerializableUtil.Deserialize <ByteStruct>(bytes); Expect.AreEqual(7, byteObj.a); }
public void TestDeserializeClass() { var bytes = new byte[] { 7 }; var byteObj = SerializableUtil.Deserialize <ByteType>(bytes); Expect.AreEqual(7, byteObj.a); }
public void TestSerializeMultiStruct() { var byteStruct = new BytesStruct { a = 7, b = 3 }; Expect.AreArraysEqual(new byte[] { 7, 0, 3 }, SerializableUtil.Serialize(byteStruct)); }
public void TestSerializeSingletonStruct() { var byteStruct = new ByteStruct { a = 7 }; Expect.AreArraysEqual(new byte[] { 7 }, SerializableUtil.Serialize(byteStruct)); }
public void TestSerializeClass() { var obj = new ByteType { a = 7 }; var bytes = SerializableUtil.Serialize(obj); Expect.AreArraysEqual(new byte[] { 7 }, bytes); }
public void TestGetSizeOf() { Expect.AreEqual(4, SerializableUtil.GetSizeOf(typeof(Int32Type))); Expect.AreEqual(8, SerializableUtil.GetSizeOf(typeof(Int64Type))); Expect.AreEqual(12, SerializableUtil.GetSizeOf(typeof(Int32And64Type))); Expect.AreEqual(13, SerializableUtil.GetSizeOf(typeof(PackedInt32And64Type))); Expect.AreEqual(1, SerializableUtil.GetSizeOf(typeof(ByteType))); }