You've already forked linux-packaging-mono
Imported Upstream version 6.6.0.89
Former-commit-id: b39a328747c2f3414dc52e009fb6f0aa80ca2492
This commit is contained in:
parent
cf815e07e0
commit
95fdb59ea6
66
external/api-doc-tools/mdoc/mdoc.Test/Enumeration/ExceptionTests.cs
vendored
Normal file
66
external/api-doc-tools/mdoc/mdoc.Test/Enumeration/ExceptionTests.cs
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
using Mono.Documentation;
|
||||
using NUnit.Framework;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace mdoc.Test.Enumeration
|
||||
{
|
||||
[TestFixture ()]
|
||||
public class ExceptionTests : CecilBaseTest
|
||||
{
|
||||
[Test ()]
|
||||
public void TestExceptionEnumerations ()
|
||||
{
|
||||
var type = GetTypeDef<ExceptionTestClass> ();
|
||||
var member = type.Methods.Single (m => m.Name == "ThrowAnException");
|
||||
|
||||
var sources = new ExceptionLookup (ExceptionLocations.DependentAssemblies)[member];
|
||||
|
||||
Assert.IsNotNull (sources);
|
||||
Assert.AreEqual (1, sources.Count ());
|
||||
var source = sources.First ();
|
||||
Assert.AreEqual ("ThrowAnException", source.Sources.First ().Name);
|
||||
}
|
||||
|
||||
[Test ()]
|
||||
public void TestExceptionEnumerations_FromPrivateMethod ()
|
||||
{
|
||||
var type = GetTypeDef<ExceptionTestClass> ();
|
||||
var member = type.Methods.Single (m => m.Name == "ThrowFromPrivateMethod");
|
||||
|
||||
var sources = new ExceptionLookup (ExceptionLocations.DependentAssemblies)[member];
|
||||
|
||||
Assert.IsNotNull (sources);
|
||||
Assert.AreEqual (0, sources.Count ());
|
||||
}
|
||||
|
||||
[Test ()]
|
||||
public void TestExceptionEnumerations_FromPublicMethod ()
|
||||
{
|
||||
var type = GetTypeDef<ExceptionTestClass> ();
|
||||
var member = type.Methods.Single (m => m.Name == "ThrowFromPublicMethod");
|
||||
|
||||
var sources = new ExceptionLookup (ExceptionLocations.Assembly)[member];
|
||||
|
||||
Assert.IsNotNull (sources);
|
||||
Assert.AreEqual (1, sources.Count ());
|
||||
var source = sources.First ();
|
||||
Assert.AreEqual ("ThrowItPublic", source.Sources.First ().Name);
|
||||
}
|
||||
|
||||
public class ExceptionTestClass
|
||||
{
|
||||
public void ThrowAnException()
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
public void ThrowFromPrivateMethod () => ThrowItPrivate ();
|
||||
private void ThrowItPrivate () => throw new NotImplementedException ();
|
||||
|
||||
|
||||
public void ThrowFromPublicMethod () => ThrowItPublic ();
|
||||
public void ThrowItPublic () => throw new NotImplementedException ();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user