public void PropertyValueSerializeTest() { PropertyValue pv = PreparePropertyValue(); XElementFormatter formatter = new XElementFormatter(); XmlSerializeContext context = new XmlSerializeContext(); XElement root = new XElement("root"); pv.Serialize(root, context); Console.WriteLine(root.ToString()); XmlDeserializeContext dcontext = new XmlDeserializeContext(); PropertyValue newPropertyValue = new PropertyValue(new PropertyDefine()); newPropertyValue.Deserialize(root, dcontext); //Assert.AreEqual(root.ToString(), rootReserialized.ToString()); Assert.AreEqual(pv.StringValue, newPropertyValue.StringValue); Assert.AreEqual(pv.Definition.Name, newPropertyValue.Definition.Name); }