Example #1
0
        public void Test_FromXml_Append_Decimals_M7()
        {
            XmlDocument doc = new XmlDocument();

            XmlElement elem = doc.CreateElement("test");

            doc.AppendChild(elem);

            Precision pp = new Precision(Precision.PrecisionTypeCode.Decimals, -7);

            XmlAttribute attr = pp.CreateAttribute(doc);

            Precision p = null;

            ArrayList errors = new ArrayList();

            Assert.IsTrue(Precision.TryCreateFromXml(attr, out p, ref errors), "precision not created");

            Assert.IsTrue(p.ValueEquals(pp), "xml precision different from the real deal");
        }
Example #2
0
        public void Test_Append_PrecisionINF()
        {
            XmlDocument doc = new XmlDocument();

            XmlElement elem = doc.CreateElement("test");

            doc.AppendChild(elem);

            Precision pp = new Precision(Precision.PrecisionTypeCode.Precision);

            elem.Attributes.Append(pp.CreateAttribute(doc));

            string expectedXML =
                @"<?xml version=""1.0"" encoding=""utf-16""?>
<test decimals=""INF"" />";

            System.IO.StringWriter writer = new System.IO.StringWriter();

            doc.Save(writer);
            Assert.AreEqual(expectedXML, writer.ToString());
        }