|
|
|
|
|
|
var serialized = SerializationHelper.Serialize<SimpleSerializeClass>(toSerialize); |
|
|
|
Assert.AreEqual(1, serialized.Count); |
|
|
|
|
|
|
|
var loaded = SerializationHelper.Deserialize<SimpleSerializeClass>(serialized, null); |
|
|
|
var loaded = SerializationHelper.Deserialize<SimpleSerializeClass>(serialized, GraphUtil.GetLegacyTypeRemapping()); |
|
|
|
Assert.AreEqual(1, loaded.Count); |
|
|
|
Assert.IsInstanceOf<SimpleSerializeClass>(loaded[0]); |
|
|
|
loaded[0].AssertAsReference(); |
|
|
|
|
|
|
var serialized = SerializationHelper.Serialize<SimpleSerializeClass>(toSerialize); |
|
|
|
Assert.AreEqual(3, serialized.Count); |
|
|
|
|
|
|
|
var loaded = SerializationHelper.Deserialize<SimpleSerializeClass>(serialized, null); |
|
|
|
var loaded = SerializationHelper.Deserialize<SimpleSerializeClass>(serialized, GraphUtil.GetLegacyTypeRemapping()); |
|
|
|
Assert.AreEqual(3, loaded.Count); |
|
|
|
Assert.IsInstanceOf<SimpleSerializeClass>(loaded[0]); |
|
|
|
Assert.IsInstanceOf<ChildClassA>(loaded[1]); |
|
|
|
|
|
|
var serialized = SerializationHelper.Serialize<ITestInterface>(toSerialize); |
|
|
|
Assert.AreEqual(3, serialized.Count); |
|
|
|
|
|
|
|
var loaded = SerializationHelper.Deserialize<SimpleSerializeClass>(serialized, null); |
|
|
|
var loaded = SerializationHelper.Deserialize<SimpleSerializeClass>(serialized, GraphUtil.GetLegacyTypeRemapping()); |
|
|
|
Assert.AreEqual(3, loaded.Count); |
|
|
|
Assert.IsInstanceOf<SimpleSerializeClass>(loaded[0]); |
|
|
|
Assert.IsInstanceOf<ChildClassA>(loaded[1]); |
|
|
|
|
|
|
var serializedContainer = JsonUtility.ToJson(container, true); |
|
|
|
|
|
|
|
var deserializedContainer = JsonUtility.FromJson<SerializationContainer>(serializedContainer); |
|
|
|
var loaded = SerializationHelper.Deserialize<SimpleSerializeClass>(deserializedContainer.serializedElements, null); |
|
|
|
var loaded = SerializationHelper.Deserialize<SimpleSerializeClass>(deserializedContainer.serializedElements, GraphUtil.GetLegacyTypeRemapping()); |
|
|
|
Assert.AreEqual(1, loaded.Count); |
|
|
|
Assert.IsInstanceOf<SimpleSerializeClass>(loaded[0]); |
|
|
|
loaded[0].AssertAsReference(); |
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
var serialized = SerializationHelper.Serialize<MaterialSlot>(toSerialize); |
|
|
|
var loaded = SerializationHelper.Deserialize<MaterialSlot>(serialized, null); |
|
|
|
var loaded = SerializationHelper.Deserialize<MaterialSlot>(serialized, GraphUtil.GetLegacyTypeRemapping()); |
|
|
|
Assert.AreEqual(2, loaded.Count); |
|
|
|
|
|
|
|
Assert.IsInstanceOf<MaterialSlot>(loaded[0]); |
|
|
|