public void DotNetQualifiedClassNameTreeNode_Generate_Empty() { //arrange List <DotNetQualifiedClassName> names = new List <DotNetQualifiedClassName>(); //act DotNetQualifiedClassNameTreeNode root = DotNetQualifiedClassNameTreeNode.Generate(names); //assert Assert.IsNull(root.Value); Assert.AreEqual(0, root.Children.Count); }
public void DotNetQualifiedClassNameTreeNode_Generate_FirstRoot() { //arrange DotNetQualifiedClassName a = DotNetQualifiedClassName.FromVisualStudioXml("NameA.ClassA"); //act DotNetQualifiedClassNameTreeNode root = DotNetQualifiedClassNameTreeNode.Generate(null); root.Insert(a); //assert Assert.AreEqual(a, root.Value); Assert.AreEqual(0, root.Children.Count); }
public void DotNetQualifiedClassNameTreeNode_Generate_One() { //arrange List <DotNetQualifiedClassName> names = new List <DotNetQualifiedClassName>() { DotNetQualifiedClassName.FromVisualStudioXml("NameA.ClassA") }; //act DotNetQualifiedClassNameTreeNode root = DotNetQualifiedClassNameTreeNode.Generate(names); //assert Assert.AreEqual("NameA.ClassA", root.Value); Assert.AreEqual(0, root.Children.Count); }
public void DotNetQualifiedClassNameTreeNode_Generate_ChildOfRoot() { //arrange DotNetQualifiedClassName a = DotNetQualifiedClassName.FromVisualStudioXml("NameA.NameB"); DotNetQualifiedClassName b = DotNetQualifiedClassName.FromVisualStudioXml("NameA.NameB.Filler.NameC"); //act DotNetQualifiedClassNameTreeNode root = DotNetQualifiedClassNameTreeNode.Generate(null); root.Insert(a); root.Insert(b); //assert Assert.AreEqual(a, root.Value); Assert.AreEqual(1, root.Children.Count); Assert.AreEqual(b, root.Children[0].Value); }
public void DotNetQualifiedClassNameTreeNode_Generate_MultipleRoots() { //arrange DotNetQualifiedClassName a = DotNetQualifiedClassName.FromVisualStudioXml("NameA.NameB"); DotNetQualifiedClassName c = DotNetQualifiedClassName.FromVisualStudioXml("NameC"); //act DotNetQualifiedClassNameTreeNode root = DotNetQualifiedClassNameTreeNode.Generate(null); root.Insert(a); root.Insert(c); //assert Assert.AreEqual(null, root.Value); Assert.AreEqual(2, root.Children.Count); Assert.AreEqual(a, root.Children[0].Value); Assert.AreEqual(0, root.Children[0].Children.Count); Assert.AreEqual(c, root.Children[1].Value); Assert.AreEqual(0, root.Children[1].Children.Count); }
public void DotNetQualifiedClassNameTreeNode_Generate_BetweenRootAndChild() { //arrange DotNetQualifiedClassName a = DotNetQualifiedClassName.FromVisualStudioXml("NameA.NameB"); DotNetQualifiedClassName c = DotNetQualifiedClassName.FromVisualStudioXml("NameA.NameB.Filler.NameC"); DotNetQualifiedClassName d = DotNetQualifiedClassName.FromVisualStudioXml("NameA.NameB.Filler.NameD"); DotNetQualifiedClassName e = DotNetQualifiedClassName.FromVisualStudioXml("NameA.NameB.Filler"); //act DotNetQualifiedClassNameTreeNode root = DotNetQualifiedClassNameTreeNode.Generate(null); root.Insert(a); root.Insert(c); root.Insert(d); root.Insert(e); //assert Assert.AreEqual(a, root.Value); Assert.AreEqual(1, root.Children.Count); Assert.AreEqual(e, root.Children[0].Value); Assert.AreEqual(2, root.Children[0].Children.Count); Assert.AreEqual(c, root.Children[0].Children[0].Value); Assert.AreEqual(d, root.Children[0].Children[1].Value); }
private void GenerateTableOfContents(DotNetDocumentationFile xmlDocumentation, string directory) { List <DotNetQualifiedClassName> _namespaces = new List <DotNetQualifiedClassName>(); foreach (DotNetType type in xmlDocumentation.Types) { _namespaces.Add(type.ClassName.FullClassNamespace); } foreach (DotNetDelegate _delegate in xmlDocumentation.Delegates) { _namespaces.Add(_delegate.MethodName.FullClassNamespace); } _namespaces = _namespaces.Distinct().ToList(); DotNetQualifiedClassNameTreeNode root = DotNetQualifiedClassNameTreeNode.Generate(_namespaces); GenerateAndSaveTableOfContents(xmlDocumentation, root, directory); //master table of contents MarkdownFile markdown = new MarkdownFile(); MarkdownSection section = markdown.AddSection("Table of Contents"); if (root.Value == null) { foreach (DotNetQualifiedClassNameTreeNode node in root.Children) { MarkdownSection subsection = BuildMasterSummary(xmlDocumentation, node); section.AddSection(subsection); } } else { MarkdownSection subsection = BuildMasterSummary(xmlDocumentation, root); section.AddSection(subsection); } Save(markdown, directory, "TableOfContents" + Ext.MD); }