1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
|
using Mono.Documentation.Updater.CppFormatters;
using Mono_DocTest;
using NUnit.Framework;
using Cpp = Mono_DocTest_Generic;
namespace mdoc.Test
{
[TestFixture]
public class CppWinRtMembersTests: BasicFormatterTests<CppWinRtFullMemberFormatter>
{
private static readonly CppWinRtFullMemberFormatter CppWinRtFullMemberFormatter = new CppWinRtFullMemberFormatter();
protected override CppWinRtFullMemberFormatter formatter => CppWinRtFullMemberFormatter;
private string CppCxTestLibName = "../../../../external/Test/UwpTestWinRtComponentCpp.winmd";
private const string CSharpTestLib = "../../../../external/Test/CSharpExample.dll";
[Test]
[Category("Method")]
public void Method_ComputeResult()
{
TestMethodSignature(CppCxTestLibName, "UwpTestWinRtComponentCpp.Class1", "ComputeResult",
@"winrt::Windows::Foundation::Collections::IVector<double> ComputeResult(double input);");
}
[Test]
[Category("Method")]
public void Method_GetPrimesOrdered()
{
TestMethodSignature(CppCxTestLibName, "UwpTestWinRtComponentCpp.Class1", "GetPrimesOrdered",
@"winrt::Windows::Foundation::IAsyncOperationWithProgress<Windows::Foundation::Collections::IVector<int>, double> GetPrimesOrdered(int first, int last);");
}
[Test]
[Category("Method")]
public void Method_GetPrimesUnordered()
{
TestMethodSignature(CppCxTestLibName, "UwpTestWinRtComponentCpp.Class1", "GetPrimesUnordered",
@"winrt::Windows::Foundation::IAsyncActionWithProgress<double> GetPrimesUnordered(int first, int last);");
}
[Test]
[Category("Method")]
public void Method_DefaultParameters()
{
TestMethodSignature(CSharpTestLib, "Mono.DocTest.Widget", "Default",
@"void Default(int a = 1, int b = 2);");
}
[Test]
[Category("Method")]
public void Method_RefType()
{
TestMethodSignature(CppCxTestLibName, "Namespace222.App", "SetWindow1",
@"void SetWindow1(winrt::Windows::UI::Core::CoreWindow const & window);");
}
[Test]
[Category("Method")]
public void Method_WinRtTypeInterfaceImplementation()
{
TestMethodSignature(CppCxTestLibName, "Namespace222.App", "SetWindow",
@"void SetWindow(winrt::Windows::UI::Core::CoreWindow const & window);");
}
[Test]
[Category("Fields")]
public void FieldSignature_ConstLong() =>
TestFieldSignature(typeof(Cpp.GenericBase<>),
"const long ConstLong;",
nameof(Cpp.GenericBase<int>.ConstLong));
[Test]
[Category("Fields")]
public void FieldSignature_ConstChar() =>
TestFieldSignature(typeof(Cpp.GenericBase<>),
"const char ConstChar;",
nameof(Cpp.GenericBase<int>.ConstChar));
#region NoSupport
[Test]
[Category("NoSupport")]
public void NoSupport_Property()
{
TestPropertySignature(CppCxTestLibName, "Namespace2.Class3", "LongProperty", null);
}
[Test]
[Category("NoSupport")]
public void NoSupport_Event()
{
TestEventSignature(CppCxTestLibName, "UwpTestWinRtComponentCpp.Class1", "primeFoundEvent", null);
}
[Test]
[Category("NoSupport")]
public void NoSupport_ExtensionMethod()
{
TestMethodSignature(typeof(Cpp.Extensions), null, nameof(Cpp.Extensions.Bar));
}
[Test]
[Category("NoSupport")]
public void NoSupport_SystemTypes()
{
TestMethodSignature(typeof(Cpp.Extensions), null, nameof(Cpp.Extensions.Bar));
}
[Test]
[Category("NoSupport")]
public void MethodSignature_ParamsKeyword_M6()
{
TestMethodSignature(typeof(Widget), null, "M6");
}
[Test]
[Category("NoSupport")]
public void NoSupport_StandardType()
{
TestMethodSignature(typeof(UseLists), null, nameof(UseLists.Process));
}
[Test]
[Category("Fields")]
public void NoSupport_Decimal() =>
TestFieldSignature(typeof(Cpp.GenericBase<>),
null,
nameof(Cpp.GenericBase<int>.ConstDecimal));
#endregion
}
}
|