You've already forked linux-packaging-mono
Imported Upstream version 5.4.0.167
Former-commit-id: 5624ac747d633e885131e8349322922b6a59baaa
This commit is contained in:
parent
e49d6f06c0
commit
536cd135cc
70
external/api-doc-tools/monodoc/Test/Monodoc.Generators/RawGeneratorTests.cs
vendored
Normal file
70
external/api-doc-tools/monodoc/Test/Monodoc.Generators/RawGeneratorTests.cs
vendored
Normal file
@ -0,0 +1,70 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
using Monodoc;
|
||||
using Monodoc.Generators;
|
||||
|
||||
namespace MonoTests.Monodoc.Generators
|
||||
{
|
||||
[TestFixture]
|
||||
public class RawGeneratorTests
|
||||
{
|
||||
RootTree rootTree;
|
||||
RawGenerator generator = new RawGenerator ();
|
||||
|
||||
[SetUp]
|
||||
public void Setup ()
|
||||
{
|
||||
rootTree = RootTree.LoadTree (GetBaseDir (), false);
|
||||
}
|
||||
|
||||
static string GetBaseDir ([CallerFilePath] string baseDir = "")
|
||||
{
|
||||
return Path.Combine (Path.GetDirectoryName (baseDir), "..", "monodoc_test");
|
||||
}
|
||||
|
||||
void AssertValidXml (string xml)
|
||||
{
|
||||
var reader = XmlReader.Create (new StringReader (xml));
|
||||
try {
|
||||
while (reader.Read ());
|
||||
} catch (Exception e) {
|
||||
Console.WriteLine (e.ToString ());
|
||||
Assert.Fail (e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
void AssertEcmaFullTypeName (string xml, string fullTypeName)
|
||||
{
|
||||
var reader = XmlReader.Create (new StringReader (xml));
|
||||
Assert.IsTrue (reader.ReadToFollowing ("Type"));
|
||||
Assert.AreEqual (fullTypeName, reader.GetAttribute ("FullName"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSimpleEcmaXml ()
|
||||
{
|
||||
var xml = rootTree.RenderUrl ("T:System.String", generator);
|
||||
Assert.IsNotNull (xml);
|
||||
Assert.That (xml, Is.Not.Empty);
|
||||
AssertValidXml (xml);
|
||||
AssertEcmaFullTypeName (xml, "System.String");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSimpleEcmaXml2 ()
|
||||
{
|
||||
var xml = rootTree.RenderUrl ("T:System.Int32", generator);
|
||||
Assert.IsNotNull (xml);
|
||||
Assert.That (xml, Is.Not.Empty);
|
||||
AssertValidXml (xml);
|
||||
AssertEcmaFullTypeName (xml, "System.Int32");
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user