File: CppWinRtMembersTests.cs

package info (click to toggle)
mono 6.12.0.199%2Bds-4
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,192 kB
  • sloc: cs: 11,181,844; xml: 2,850,076; ansic: 689,413; cpp: 123,344; perl: 59,361; javascript: 30,841; asm: 21,845; makefile: 19,951; sh: 15,030; python: 4,771; pascal: 925; sql: 859; sed: 16; php: 1
file content (134 lines) | stat: -rw-r--r-- 4,545 bytes parent folder | download | duplicates (7)
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
    }
}