コード例 #1
0
        public void TestCreateXml_UnserializableValue()
        {
            GenericParameter g = new GenericParameter();
            ObjectValue      v = g.Value as ObjectValue;

            v.Value = new NotSerializable();
            XElement xml = g.CreateXml();
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }