public void TestConnectionSerialization() { var obj = new Connection { Id = Guid.NewGuid(), Type = ExpressionNodeType.Connection, Sink = new ConnectorIn(null) {Id = Guid.NewGuid()}, Source = new ConnectorOut(null) {Id = Guid.NewGuid()} }; var tw = new StringWriter(); using (var xw = XmlWriter.Create(tw)) { xw.WriteStartElement("Node"); obj.Serialize(xw); xw.WriteEndElement(); } var sr = new StringReader(tw.ToString()); using (var wr = XmlReader.Create(sr)) { wr.ReadToFollowing("Node"); var result = new Connection(); result.Deserialize(wr); Assert.AreEqual(obj.Id, result.Id); Assert.AreEqual(obj.Type, result.Type); Assert.AreEqual(obj.Sink.Id, result.Sink.Id); Assert.AreEqual(obj.Source.Id, result.Source.Id); } }