public void TestCreateXml_UnserializableValue() { GenericParameter g = new GenericParameter(); ObjectValue v = g.Value as ObjectValue; v.Value = new NotSerializable(); XElement xml = g.CreateXml(); }
public void TestCreateXml_NullValue() { GenericParameter g = new GenericParameter(); ObjectValue v = g.Value as ObjectValue; Assert.IsNull(v.Value); XElement xml = g.CreateXml(); XElement valEl = xml.Descendants("value").First(); Assert.IsNotNull(valEl.FirstNode); Assert.IsTrue(valEl.FirstNode.NodeType == System.Xml.XmlNodeType.CDATA); }
public void TestCreateXml_SerializableValue() { GenericParameter g = new GenericParameter(); ObjectValue v = g.Value as ObjectValue; v.Value = new SerializableClass(); XElement xml = g.CreateXml(); GenericParameter g2 = new GenericParameter(); ObjectValue v2 = g2.Value as ObjectValue; g2.Restore(xml); Assert.IsNotNull(v2.Value); }
public void TestCreateXml_Primative() { GenericParameter g = new GenericParameter(); ObjectValue v = g.Value as ObjectValue; v.Value = 1d; XElement xml = g.CreateXml(); XElement valEl = xml.Descendants("value").First(); Assert.IsNotNull(valEl.FirstNode); Assert.IsTrue(valEl.FirstNode.NodeType == System.Xml.XmlNodeType.CDATA); GenericParameter g2 = new GenericParameter(); ObjectValue v2 = g2.Value as ObjectValue; g2.Restore(xml); Assert.AreEqual(v.Value, v2.Value); }