public void TestManualCloneViaSerializeDeserialize() { NonGenericBasic ngb = new NonGenericBasic { Value = 123 }, clone; using (MemoryStream ms = new MemoryStream()) { Serializer.NonGeneric.Serialize(ms, ngb); ms.Position = 0; clone = (NonGenericBasic)Serializer.NonGeneric.Deserialize( ngb.GetType(), ms); } Assert.AreNotSame(ngb, clone); Assert.AreEqual(ngb.Value, clone.Value); }
public void TestManualCloneViaSerializeDeserialize() { NonGenericBasic ngb = new NonGenericBasic { Value = 123 }, clone; using (MemoryStream ms = new MemoryStream()) { #pragma warning disable CS0618 Serializer.NonGeneric.Serialize(ms, ngb); ms.Position = 0; clone = (NonGenericBasic)Serializer.NonGeneric.Deserialize( ngb.GetType(), ms); #pragma warning restore CS0618 } Assert.NotSame(ngb, clone); Assert.Equal(ngb.Value, clone.Value); }