public void TestStringPropertyToXml()
        {
            var serializable = new WithStringMandatoryProperty()
            {
                AnyString = null
            };

            var xml = serializable.ToXml();

            var doc     = XDocument.Parse(xml);
            var element = doc.XPathSelectElement("/String/AnyString");

            Assert.AreEqual("", element.Value);
        }
        public void TestTypeInfoNotEmittedForNull()
        {
            var serializable = new WithStringMandatoryProperty()
            {
                AnyString = null
            };

            string xml = serializable.ToXml(true);

            Assert.IsTrue(!xml.Contains("__type"), "Type info found");

            var deserialized = XmlSerialization.LoadFromXml <WithStringMandatoryProperty>(xml);

            Assert.AreEqual(serializable.AnyString, deserialized.AnyString);
        }
        public void TestEmptyStringMandatoryPropertyToXml()
        {
            var serializable = new WithStringMandatoryProperty()
            {
                AnyString = ""
            };

            var xml = serializable.ToXml();

            var doc     = XDocument.Parse(xml);
            var element = doc.XPathSelectElement("/String/AnyString");

            // Check that element is empty, but still created
            Assert.AreEqual("", element.Value);
        }