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
95
external/api-doc-tools/mdoc/mdoc.Test/Enumeration/AttachedEntityTests.cs
vendored
Normal file
95
external/api-doc-tools/mdoc/mdoc.Test/Enumeration/AttachedEntityTests.cs
vendored
Normal file
@@ -0,0 +1,95 @@
|
||||
using NUnit.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Mono.Documentation.Util;
|
||||
using Windows.UI.Xaml;
|
||||
using Mono.Documentation.Updater;
|
||||
|
||||
namespace mdoc.Test.Enumeration
|
||||
{
|
||||
[TestFixture]
|
||||
public class AttachedEntityTests : CecilBaseTest
|
||||
{
|
||||
[TestCase]
|
||||
public void Test_NoEntities()
|
||||
{
|
||||
var type = GetTypeDef<AttachedTestClassNoAttachedEntities>();
|
||||
var list = AttachedEntitiesHelper.GetAttachedEntities(type);
|
||||
|
||||
Assert.IsFalse(list.Any());
|
||||
}
|
||||
|
||||
[TestCase]
|
||||
public void Test_AttachedProperty()
|
||||
{
|
||||
var type = GetTypeDef<AttachedTestClass>();
|
||||
var list = AttachedEntitiesHelper.GetAttachedEntities(type);
|
||||
|
||||
Assert.AreEqual(3, list.Count());
|
||||
}
|
||||
|
||||
[TestCase]
|
||||
public void Test_AttachedProperty_Formatter()
|
||||
{
|
||||
string expected = "see GetSome, and SetSome";
|
||||
|
||||
var type = GetTypeDef<AttachedTestClass>();
|
||||
var list = AttachedEntitiesHelper.GetAttachedEntities(type);
|
||||
|
||||
MemberFormatter formatter = new CSharpMemberFormatter();
|
||||
string def = formatter.GetDeclaration(list.First());
|
||||
Assert.AreEqual(expected, def);
|
||||
}
|
||||
|
||||
[TestCase]
|
||||
public void Test_AttachedProperty_Formatter_GetOnly()
|
||||
{
|
||||
string expected = "see GetSomeGet";
|
||||
|
||||
var type = GetTypeDef<AttachedTestClass>();
|
||||
var list = AttachedEntitiesHelper.GetAttachedEntities(type);
|
||||
|
||||
MemberFormatter formatter = new CSharpMemberFormatter();
|
||||
string def = formatter.GetDeclaration(list.Skip(1).First());
|
||||
Assert.AreEqual(expected, def);
|
||||
}
|
||||
|
||||
[TestCase]
|
||||
public void Test_AttachedProperty_Formatter_SetOnly()
|
||||
{
|
||||
string expected = "see SetSomeSet";
|
||||
|
||||
var type = GetTypeDef<AttachedTestClass>();
|
||||
var list = AttachedEntitiesHelper.GetAttachedEntities(type);
|
||||
|
||||
MemberFormatter formatter = new CSharpMemberFormatter();
|
||||
string def = formatter.GetDeclaration(list.Skip(2).First());
|
||||
Assert.AreEqual(expected, def);
|
||||
}
|
||||
|
||||
public class AttachedTestClassNoAttachedEntities { }
|
||||
|
||||
public class AttachedTestClass
|
||||
{
|
||||
public static readonly DependencyProperty SomeProperty;
|
||||
public static bool GetSome(DependencyObject obj) { return false; }
|
||||
public static void SetSome(DependencyObject obj, bool val) { }
|
||||
|
||||
|
||||
public static readonly DependencyProperty SomeGetProperty;
|
||||
public static bool GetSomeGet(DependencyObject obj) { return false; }
|
||||
|
||||
|
||||
public static readonly DependencyProperty SomeSetProperty;
|
||||
public static void SetSomeSet(DependencyObject obj, bool val) { }
|
||||
|
||||
|
||||
public static DependencyProperty SomeNotReadonlyProperty;
|
||||
public static bool GetSomeNotReadOnly(DependencyObject obj) { return false; }
|
||||
public static void SetSomeNotReadOnly(DependencyObject obj, bool val) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user