public void SerializationUtility_SaveToMemory_2() { CanaryClass first = new CanaryClass(); byte[] memory = first.SaveToMemory(); CanaryClass second = memory.RestoreObjectFromMemory <CanaryClass>(); first.EnsureSame(second); }
public void SerializationUtility_SaveToMemory_3() { const int arraySize = 10; CanaryClass[] first = new CanaryClass[arraySize]; for (int i = 0; i < arraySize; i++) { first[i] = _GetCanary(); first[i].Age = i; } byte[] memory = first.SaveToMemory(); CanaryClass[] second = memory.RestoreArrayFromMemory <CanaryClass>(); Assert.AreEqual(first.Length, second.Length); for (int i = 0; i < arraySize; i++) { first[i].EnsureSame(second[i]); } }