public void TestExpressionObjectBaseSerialization() { var obj = new SampleExpression { Id = Guid.NewGuid(), FunctionName = "func", ExpressionName = "expr", Left = 1, Top = 2, Width = 3, Height = 4 }; 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 SampleExpression(); result.Deserialize(wr); Assert.AreEqual(obj.Id, result.Id); Assert.AreEqual(obj.FunctionName, result.FunctionName); Assert.AreEqual(obj.ExpressionName, result.ExpressionName); Assert.AreEqual(obj.Left, result.Left); Assert.AreEqual(obj.Top, result.Top); Assert.AreEqual(obj.Width, result.Width); Assert.AreEqual(obj.Height, result.Height); } }