public void Test_WhereUsed() { RoleType rt = new RoleType("uri", "id", "schemaFile"); rt.AddLink("link:one"); rt.AddLink("link:two"); rt.AddLink("link:Three"); Assert.IsTrue(rt.UsedIn("one")); Assert.IsTrue(rt.UsedIn("two")); Assert.IsFalse(rt.UsedIn("seven")); }
private void LoadRoleTypes( out int numErrors ) { numErrors = 0; XmlNodeList pTypesList = theDocument.SelectNodes(RTYPE_KEY, theManager); if (pTypesList == null || pTypesList.Count == 0) { return; // nothing to do } else if (roleTypes == null) { roleTypes = new Dictionary<string,RoleType>(pTypesList.Count); } ArrayList labelRoleTypes = new ArrayList(); foreach (XmlNode node in pTypesList) { if (node.ChildNodes.Count == 0) { ++numWarnings; Common.WriteWarning("XBRLParser.Warning.NoChildrenForNode", errorList, node.OuterXml); continue; } string id = null; string uri = null; if (!Common.GetAttribute(node, ID_TAG, ref id, errorList) || !Common.GetAttribute(node, RURI_TAG, ref uri, errorList)) { ++numErrors; continue; // Couldn't find an attribute, just ignore it } RoleType rt = new RoleType( uri, id, this.schemaFile ); foreach (XmlNode child in node.ChildNodes) { if (child.NodeType == XmlNodeType.Comment) continue; if (child.LocalName == DEF_TAG) { rt.SetDefinition(child.InnerText); } else { try { rt.AddLink(child.InnerText); } catch (ArgumentNullException) { Common.WriteWarning("XBRLParser.Warning.EmptyNode", errorList, child.OuterXml); ++numWarnings; } } } roleTypes[uri] = rt; // if it's a label role type, then we want to union it // with the other label roles that were set when we loaded // the taxonomy label file. if ( RoleTypeDefinesLabelUsage( rt ) ) { labelRoleTypes.Add( rt.id ); } } MergeLanguagesAndLabelRoles( null, labelRoleTypes ); }
public void Test_WhereUsed() { RoleType rt = new RoleType( "uri", "id", "schemaFile" ); rt.AddLink( "link:one" ); rt.AddLink( "link:two" ); rt.AddLink( "link:Three" ); Assert.IsTrue( rt.UsedIn( "one" ) ); Assert.IsTrue( rt.UsedIn( "two" ) ); Assert.IsFalse( rt.UsedIn( "seven" ) ); }