[runtime] Disable some tests in full-aot mode which cannot be AOTed because of type...
[mono.git] / mcs / class / monodoc / Test / Monodoc / RootTreeTest.cs
1 using System;
2 using System.IO;
3 using System.Linq;
4 using System.Collections.Generic;
5
6 using NUnit.Framework;
7
8 using Monodoc;
9 using Monodoc.Generators;
10
11 namespace MonoTests.Monodoc
12 {
13         [TestFixture]
14         public class RootTreeTest
15         {
16                 const string BaseDir = "../../class/monodoc/Test/monodoc_test/";
17
18                 RootTree root;
19                 HtmlGenerator generator;
20
21                 [SetUp]
22                 public void Setup ()
23                 {
24                         root = RootTree.LoadTree (BaseDir, includeExternal: false);
25                         generator = new HtmlGenerator (defaultCache: null);
26                 }
27
28                 [Test]
29                 public void RootTreePageTest ()
30                 {
31                         var content = root.RenderUrl ("root:", generator);
32                         Assert.IsNotNull (content);
33                         StringAssert.Contains ("The following documentation collections are available:", content);
34                 }
35
36                 IEnumerable<Node> GetNodesWithSummaries (Node baseNode)
37                 {
38                         return baseNode.ChildNodes.Where (n => n.Element.StartsWith ("root:/")).SelectMany (n => new[] { n }.Concat (GetNodesWithSummaries (n)));
39                 }
40
41                 [Test]
42                 public void HelpSourceSummariesTest ()
43                 {
44                         foreach (var node in GetNodesWithSummaries (root.RootNode)) {
45                                 var content = root.RenderUrl (node.Element, generator);
46                                 Assert.IsNotNull (content, "#1 - " + node.Element);
47                                 if (node.ChildNodes.All (n => n.Element.StartsWith ("root:/")))
48                                         StringAssert.Contains ("This node doesn't have a summary available", content, "#2a - " + node.Element);
49                                 else {
50                                         Assert.IsFalse (content.Contains ("<em>Error:</em>"), "#2b - " + node.Element);
51                                         Assert.IsFalse (content.Contains ("This node doesn't have a summary available"), "#3b - " + node.Element);
52                                 }
53                         }
54                 }
55         }
56 }