public void ShouldSerializeSpeciallySerializable() { var special = new SpeciallySerializable(); special.Fill(100); var copy = SerializerClone(special); CollectionAssert.AreEqual(special.Data, copy.Data); }
public void ShouldSerializeStructWithSpeciallySerializable() { var special = new SpeciallySerializable(); special.Fill(100); var box = new StructGenericBox <SpeciallySerializable> { Element = special }; var copy = SerializerClone(box); Assert.AreEqual(box.Element.Data, copy.Element.Data); }
public void ShouldSerializeSpeciallySerializableInArrayAndPreserveIdentity() { var special = new SpeciallySerializable(); special.Fill(100); var str = "Some string"; var box = new Box { Element = special }; var anotherSpecial = new SpeciallySerializable(); anotherSpecial.Fill(100); var array = new object[] { special, str, box, anotherSpecial }; var copy = SerializerClone(array); Assert.AreSame(copy[0], ((Box)copy[2]).Element); Assert.AreNotSame(copy[0], copy[3]); CollectionAssert.AreEqual(((SpeciallySerializable)copy[0]).Data, special.Data); CollectionAssert.AreEqual(((SpeciallySerializable)copy[3]).Data, anotherSpecial.Data); }