public void SerializationOfAdditionalInfoTest() { var field = new SourceField(new Connection(), true); field.AdditionalInfo = new CrossReferenceFieldInfo("Process"); //Serialize properties var tw = new StringWriter(); using (var xw = XmlWriter.Create(tw)) { xw.WriteStartElement("SourceField"); field.Serialize(xw); xw.WriteEndElement(); } //Deserialize field and restore properties' values var sr = new StringReader(tw.ToString()); using (var wr = XmlReader.Create(sr)) { wr.ReadToFollowing("SourceField"); var restoredField = new SourceField(new Connection()); restoredField.Deserialize(wr); Assert.IsNotNull(restoredField.AdditionalInfo); Assert.AreEqual( ((CrossReferenceFieldInfo)field.AdditionalInfo).ReferencedProcessName, ((CrossReferenceFieldInfo)restoredField.AdditionalInfo).ReferencedProcessName); } }
public void SerializationOfGroupingRelatedPropertiesTest() { var field = new SourceField(new Connection(), true); //Serialize properties var tw = new StringWriter(); using (var xw = XmlWriter.Create(tw)) { xw.WriteStartElement("Node"); field.Serialize(xw); xw.WriteEndElement(); } //Deserialize field and restore properties' values var sr = new StringReader(tw.ToString()); using (var wr = XmlReader.Create(sr)) { wr.ReadToFollowing("Node"); var restoredField = new SourceField(new Connection()); restoredField.Deserialize(wr); Assert.AreEqual(field.IsGroupingField, restoredField.IsGroupingField); Assert.AreEqual(field.IsGroupCollapsed, restoredField.IsGroupCollapsed); Assert.AreEqual(field.KeepSubfieldsAlive, restoredField.KeepSubfieldsAlive); Assert.AreEqual(field.HideConnector, restoredField.HideConnector); } }