コード例 #1
0
        public void Test_4217_Element()
        {
            TestMeasure tm = new TestMeasure();

            tm.MeasureValue     = "USD";
            tm.MeasureNamespace = "iso4217";
            tm.MeasureSchema    = "http://www.xbrl.org/2003/iso4217";

            string expectedXml =
                @"<?xml version=""1.0"" encoding=""utf-16""?>
<xbrl xmlns:iso4217=""http://www.xbrl.org/2003/iso4217"">
  <measure>iso4217:USD</measure>
</xbrl>";

            XmlDocument doc = new XmlDocument();

            XmlElement root = doc.CreateElement("xbrl");

            doc.AppendChild(root);
            root.AppendChild(tm.CreateElement(doc, root, false));

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

            doc.Save(writer);

            Assert.AreEqual(expectedXml, writer.ToString());
        }
コード例 #2
0
        public void Test_FromXml_SharesWithNoNamespace()
        {
            TestMeasure tm = new TestMeasure();

            tm.MeasureValue     = "shares";
            tm.MeasureNamespace = "";
            tm.MeasureSchema    = "http://www.xbrl.org/2003/instance";

            XmlDocument doc = new XmlDocument();
            // set the default namespace for the root, since the element doesn't have a namespace
            XmlElement root = doc.CreateElement("xbrl", "http://www.xbrl.org/2003/instance");

            doc.AppendChild(root);
            XmlNode elem = tm.CreateElement(doc, root, false);

            ArrayList errors = null;
            Measure   mBack  = new Measure();

            Assert.IsTrue(Measure.TryCreateFromXml(elem, ref mBack, ref errors), errors.Count > 0 ? ((ParserMessage)errors[0]).Message : string.Empty);

            Assert.IsTrue(tm.Equals(mBack), "objects don't match");
        }
コード例 #3
0
        public void Test_FromXml_4217_Element()
        {
            TestMeasure tm = new TestMeasure();

            tm.MeasureValue     = "USD";
            tm.MeasureNamespace = "iso4217";
            tm.MeasureSchema    = "http://www.xbrl.org/2003/iso4217";

            XmlDocument doc = new XmlDocument();

            XmlElement root = doc.CreateElement("xbrl");

            doc.AppendChild(root);
            XmlNode elem = tm.CreateElement(doc, root, false);

            ArrayList errors = null;

            Measure mBack = new Measure();

            Assert.IsTrue(Measure.TryCreateFromXml(elem, ref mBack, ref errors), errors.Count > 0 ? ((ParserMessage)errors[0]).Message : string.Empty);

            Assert.IsTrue(tm.Equals(mBack), "objects don't match");
        }
コード例 #4
0
ファイル: TestMeasure.cs プロジェクト: plamikcho/xbrlpoc
        public void Test_4217_Element()
        {
            TestMeasure tm = new TestMeasure();
            tm.MeasureValue = "USD";
            tm.MeasureNamespace = "iso4217";
            tm.MeasureSchema = "http://www.xbrl.org/2003/iso4217";

            string expectedXml =
            @"<?xml version=""1.0"" encoding=""utf-16""?>
            <xbrl xmlns:iso4217=""http://www.xbrl.org/2003/iso4217"">
              <measure>iso4217:USD</measure>
            </xbrl>";

            XmlDocument doc = new XmlDocument();

            XmlElement root = doc.CreateElement( "xbrl" );
            doc.AppendChild( root );
            root.AppendChild( tm.CreateElement( doc, root, false ) );

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

            doc.Save( writer );

            Assert.AreEqual( expectedXml, writer.ToString() );
        }
コード例 #5
0
ファイル: TestMeasure.cs プロジェクト: plamikcho/xbrlpoc
        public void Test_FromXml_SharesWithNoNamespace()
        {
            TestMeasure tm = new TestMeasure();
            tm.MeasureValue = "shares";
            tm.MeasureNamespace = "";
            tm.MeasureSchema = "http://www.xbrl.org/2003/instance";

            XmlDocument doc = new XmlDocument();
            // set the default namespace for the root, since the element doesn't have a namespace
            XmlElement root = doc.CreateElement( "xbrl", "http://www.xbrl.org/2003/instance");
            doc.AppendChild( root );
            XmlNode elem = tm.CreateElement( doc, root, false );

            ArrayList errors = null;
            Measure mBack = new Measure();

            Assert.IsTrue( Measure.TryCreateFromXml( elem, ref mBack, ref errors  ), errors.Count > 0 ? ((ParserMessage)errors[0]).Message : string.Empty );

            Assert.IsTrue( tm.Equals( mBack ), "objects don't match" );
        }
コード例 #6
0
ファイル: TestMeasure.cs プロジェクト: plamikcho/xbrlpoc
        public void Test_FromXml_4217_Element()
        {
            TestMeasure tm = new TestMeasure();
            tm.MeasureValue = "USD";
            tm.MeasureNamespace = "iso4217";
            tm.MeasureSchema = "http://www.xbrl.org/2003/iso4217";

            XmlDocument doc = new XmlDocument();

            XmlElement root = doc.CreateElement( "xbrl" );
            doc.AppendChild( root );
            XmlNode elem = tm.CreateElement( doc, root, false );

            ArrayList errors = null;

            Measure mBack = new Measure();

            Assert.IsTrue( Measure.TryCreateFromXml( elem, ref mBack, ref errors  ), errors.Count > 0 ? ((ParserMessage)errors[0]).Message : string.Empty );

            Assert.IsTrue( tm.Equals( mBack ), "objects don't match" );
        }