public void SerializeDeserailize_listOfSerializableGetSetPropertiesOfPrimitiveType_theSame() { GetSetProperties o = new GetSetProperties { dat = "fff"}; var l = new List<GetSetProperties>(); l.Add(o); l.Add(o); var ser = new XmlSerializer(l.GetType()); var nss = new XmlSerializerNamespaces(); nss.Add(String.Empty, String.Empty); var m = new MemoryStream(); ser.Serialize(m,l, nss); m.Position = 0; var de = (List<GetSetProperties>)ser.Deserialize(m); Assert.AreEqual(o.dat, de[0].dat); Assert.AreEqual(o.dat, de[1].dat); }
public void SerializeDeserailize_serializableGetSetPropertiesOfPrimitiveType_theSame() { GetSetProperties o = new GetSetProperties{dat ="fff",StrArr = new string[]{"1","2"}}; var ser = new XmlSerializer(o.GetType()); var nss = new XmlSerializerNamespaces(); nss.Add(String.Empty, String.Empty); var m = new MemoryStream(); ser.Serialize(m, o,nss); m.Position = 0; var de = (GetSetProperties)ser.Deserialize(m); Assert.AreEqual(o.StrArr[0],de.StrArr[0]); Assert.AreEqual(o.StrArr[1], de.StrArr[1]); Assert.AreEqual(o.dat, de.dat); }