public void FSA_5_LoadAndParse() { //Trace.Listeners.Add( new TextWriterTraceListener(Console.Out) ); TestTaxonomy_FSA s = new TestTaxonomy_FSA(); int errors = 0; if ( s.Load( FSA_5_FILE, out errors ) != true ) { Assert.Fail( (string)s.ErrorList[0]); } errors = 0; // this loads up all dependant taxonomies, and loads the corresponding presentation, calculation, label, and reference linkbases s.Parse( out errors ); // loads the presentation linkbase for this taxonomy and merges the dependant taxonomy presentation linkbases if ( errors > 0 ) { SendErrorsToConsole( s.errorList ); SendWarningsToConsole( s.errorList ); SendInfoToConsole( s.ErrorList ); } // duplicate elements Assert.AreEqual( 0, errors, "parse failed" ); PresentationLink pl = s.presentationInfo[ "http://www.xbrl.org/2003/role/link" ] as PresentationLink; Assert.IsNotNull( pl, "can't get http://www.xbrl.org/role/link" ); Node parentNode = pl.CreateNode( "en", "label" ); Assert.AreEqual(2, parentNode.Children.Count, "wrong number of children" ); parentNode.Children.Sort(); // Node quarterlyReporting = null; // Node MLA002 = null; // // foreach( Node node in parentNode.Children ) // { // if( node.Label == "SECTION A: Balance sheet") // { // MLA002 = node; // } // else // { // quarterlyReporting = node; // } // } Node quarterlyReporting = parentNode.Children[1] as Node; Node MLA002 = quarterlyReporting.Children[0] as Node; Assert.AreEqual( "SECTION A: Balance sheet", MLA002.Label, "Node.Label on node MLA002 wrong" ); string text = null; MLA002.MyElement.TryGetLabel( "en", "definitionGuidance", out text ); Assert.AreEqual( 1925, text.Length, "TryGetLabel on node MLA002 wrong" ); string references = null; Assert.IsTrue( MLA002.TryGetReferences(out references ), "could not get references for MLA002" ); Assert.IsNotNull( references, "references is null" ); }
public void FSA_5_LoadAndParse() { //Trace.Listeners.Add( new TextWriterTraceListener(Console.Out) ); TestTaxonomy_FSA s = new TestTaxonomy_FSA(); int errors = 0; if (s.Load(FSA_5_FILE, out errors) != true) { Assert.Fail((string)s.ErrorList[0]); } errors = 0; // this loads up all dependant taxonomies, and loads the corresponding presentation, calculation, label, and reference linkbases s.Parse(out errors); // loads the presentation linkbase for this taxonomy and merges the dependant taxonomy presentation linkbases if (errors > 0) { SendErrorsToConsole(s.errorList); SendWarningsToConsole(s.errorList); SendInfoToConsole(s.ErrorList); } // duplicate elements Assert.AreEqual(0, errors, "parse failed"); PresentationLink pl = s.presentationInfo["http://www.xbrl.org/2003/role/link"] as PresentationLink; Assert.IsNotNull(pl, "can't get http://www.xbrl.org/role/link"); Node parentNode = pl.CreateNode("en", "label"); Assert.AreEqual(2, parentNode.Children.Count, "wrong number of children"); parentNode.Children.Sort(); // Node quarterlyReporting = null; // Node MLA002 = null; // // foreach( Node node in parentNode.Children ) // { // if( node.Label == "SECTION A: Balance sheet") // { // MLA002 = node; // } // else // { // quarterlyReporting = node; // } // } Node quarterlyReporting = parentNode.Children[1] as Node; Node MLA002 = quarterlyReporting.Children[0] as Node; Assert.AreEqual("SECTION A: Balance sheet", MLA002.Label, "Node.Label on node MLA002 wrong"); string text = null; MLA002.MyElement.TryGetLabel("en", "definitionGuidance", out text); Assert.AreEqual(1925, text.Length, "TryGetLabel on node MLA002 wrong"); string references = null; Assert.IsTrue(MLA002.TryGetReferences(out references), "could not get references for MLA002"); Assert.IsNotNull(references, "references is null"); }