public void TestNumericPropertyToXml()
        {
            var serializable = new WithNumericNullableProperty()
            {
                AnyByte   = Byte.MaxValue,
                AnySByte  = SByte.MinValue,
                AnyInt16  = Int16.MinValue,
                AnyUInt16 = UInt16.MaxValue,
                AnyInt32  = Int32.MinValue,
                AnyUInt32 = UInt32.MaxValue,
                AnyInt64  = Int64.MinValue,
                AnyUInt64 = UInt64.MaxValue
            };

            var xml = serializable.ToXml(provider: CultureInfo.InvariantCulture.NumberFormat);

            var doc              = XDocument.Parse(xml);
            var elementByte      = doc.XPathSelectElement("/Numeric/AnyByte");
            var elementSByte     = doc.XPathSelectElement("/Numeric/AnySByte");
            var elementAnyInt16  = doc.XPathSelectElement("/Numeric/AnyInt16");
            var elementAnyUInt16 = doc.XPathSelectElement("/Numeric/AnyUInt16");
            var elementAnyInt32  = doc.XPathSelectElement("/Numeric/AnyInt32");
            var elementAnyUInt32 = doc.XPathSelectElement("/Numeric/AnyUInt32");
            var elementAnyInt64  = doc.XPathSelectElement("/Numeric/AnyInt64");
            var elementAnyUInt64 = doc.XPathSelectElement("/Numeric/AnyUInt64");

            Assert.AreEqual(Byte.MaxValue.ToString("N", CultureInfo.InvariantCulture.NumberFormat), elementByte.Value);
            Assert.AreEqual(SByte.MinValue.ToString("N", CultureInfo.InvariantCulture.NumberFormat), elementSByte.Value);
            Assert.AreEqual(Int16.MinValue.ToString("N", CultureInfo.InvariantCulture.NumberFormat), elementAnyInt16.Value);
            Assert.AreEqual(UInt16.MaxValue.ToString("N", CultureInfo.InvariantCulture.NumberFormat), elementAnyUInt16.Value);
            Assert.AreEqual(Int32.MinValue.ToString("N", CultureInfo.InvariantCulture.NumberFormat), elementAnyInt32.Value);
            Assert.AreEqual(UInt32.MaxValue.ToString("N", CultureInfo.InvariantCulture.NumberFormat), elementAnyUInt32.Value);
            Assert.AreEqual(Int64.MinValue.ToString("N", CultureInfo.InvariantCulture.NumberFormat), elementAnyInt64.Value);
            Assert.AreEqual(UInt64.MaxValue.ToString("N", CultureInfo.InvariantCulture.NumberFormat), elementAnyUInt64.Value);
        }
        public void TestNumericPropertyToXml()
        {
            var serializable = new WithNumericNullableProperty()
            {
                AnyByte   = null,
                AnySByte  = null,
                AnyInt16  = null,
                AnyUInt16 = null,
                AnyInt32  = null,
                AnyUInt32 = null,
                AnyInt64  = null,
                AnyUInt64 = null
            };

            var xml = serializable.ToXml(provider: CultureInfo.InvariantCulture.NumberFormat);

            var doc              = XDocument.Parse(xml);
            var elementByte      = doc.XPathSelectElement("/Numeric/AnyByte");
            var elementSByte     = doc.XPathSelectElement("/Numeric/AnySByte");
            var elementAnyInt16  = doc.XPathSelectElement("/Numeric/AnyInt16");
            var elementAnyUInt16 = doc.XPathSelectElement("/Numeric/AnyUInt16");
            var elementAnyInt32  = doc.XPathSelectElement("/Numeric/AnyInt32");
            var elementAnyUInt32 = doc.XPathSelectElement("/Numeric/AnyUInt32");
            var elementAnyInt64  = doc.XPathSelectElement("/Numeric/AnyInt64");
            var elementAnyUInt64 = doc.XPathSelectElement("/Numeric/AnyUInt64");

            Assert.AreEqual("", elementByte.Value);
            Assert.AreEqual("", elementSByte.Value);
            Assert.AreEqual("", elementAnyInt16.Value);
            Assert.AreEqual("", elementAnyUInt16.Value);
            Assert.AreEqual("", elementAnyInt32.Value);
            Assert.AreEqual("", elementAnyUInt32.Value);
            Assert.AreEqual("", elementAnyInt64.Value);
            Assert.AreEqual("", elementAnyUInt64.Value);
        }