public void DeserializeUnknownNode()
        {
            MockConfiguration text = new MockConfiguration
            {
                Name  = "Hi",
                Data  = 1,
                Data3 = 3
            };

            XElement element = text.SerializeAsXElement("x");

            Assert.Throws <InvalidOperationException>(() => element.XmlDeserialize <MockConfiguration>("xx"));
        }
        public void Deserialize()
        {
            MockConfiguration text = new MockConfiguration
            {
                Name  = "Hi",
                Data  = 1,
                Data3 = 3
            };
            XElement element  = text.SerializeAsXElement("x");
            var      instance = element.XmlDeserialize <MockConfiguration>("x");

            Assert.AreEqual("Hi", instance.Name);
            Assert.AreEqual(1, instance.Data);
            Assert.AreEqual(3, instance.Data3);
        }
        public void SerializeAsXElement()
        {
            MockConfiguration text = new MockConfiguration
            {
                Name  = "Hi",
                Data  = 1,
                Data3 = 3
            };
            XElement element = text.SerializeAsXElement("x");

            Assert.IsNotNull(element);
            Assert.AreEqual("x", element.Name.LocalName);
            Assert.AreEqual("Hi", element.Element("Name").Value);
            Assert.AreEqual("1", element.Element("Data").Value);
            Assert.AreEqual("3", element.Element("Data3").Value);
        }
        public void SerializeAsXElementNull()
        {
            MockConfiguration text = null;

            Assert.Throws <ArgumentNullException>(() => text.SerializeAsXElement("x"));
        }