diff options
author | katsiaryna_bialiatka <katsiaryna_bialiatka@epam.com> | 2017-12-22 19:15:31 +0300 |
---|---|---|
committer | Joel Martinez <joelmartinez@gmail.com> | 2018-01-12 01:11:42 +0300 |
commit | 6533035ec31f38543532568bc499aba2a98e1788 (patch) | |
tree | c9e7e3bdefd3299bfbf28dd5bd6b5bcc43fd988f /mdoc/mdoc.Test/CppCxFormatterMembersTests.cs | |
parent | 8ff2931c4e40e1c3687e8efa6fb4e8078b3a3c4b (diff) |
[mdoc] Support for C++ signatures
Closes #132
Diffstat (limited to 'mdoc/mdoc.Test/CppCxFormatterMembersTests.cs')
-rw-r--r-- | mdoc/mdoc.Test/CppCxFormatterMembersTests.cs | 143 |
1 files changed, 143 insertions, 0 deletions
diff --git a/mdoc/mdoc.Test/CppCxFormatterMembersTests.cs b/mdoc/mdoc.Test/CppCxFormatterMembersTests.cs new file mode 100644 index 00000000..8b1e73e1 --- /dev/null +++ b/mdoc/mdoc.Test/CppCxFormatterMembersTests.cs @@ -0,0 +1,143 @@ +using Mono.Documentation.Updater.Formatters.CppFormatters; +using Mono_DocTest; +using NUnit.Framework; +using Cpp = Mono_DocTest_Generic; + +namespace mdoc.Test +{ + [TestFixture] + [Category("CppCx")] + public class CppCxFormatterMembersTests : BasicFormatterTests<CppCxFullMemberFormatter> + { + protected override CppCxFullMemberFormatter formatter { get; } = new CppCxFullMemberFormatter(); + + private const 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", + @"public: + Windows::Foundation::Collections::IVector<double> ^ ComputeResult(double input);"); + } + + [Test] + [Category("Method")] + public void Method_GetPrimesOrdered() + { + TestMethodSignature(CppCxTestLibName, "UwpTestWinRtComponentCpp.Class1", "GetPrimesOrdered", + @"public: + 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", + @"public: + Windows::Foundation::IAsyncActionWithProgress<double> ^ GetPrimesUnordered(int first, int last);"); + } + + [Test] + [Category("Method")] + public void Method_WinRtTypeInterfaceImplementation() + { + TestMethodSignature(CppCxTestLibName, "Namespace222.App", "SetWindow", + @"public: + virtual void SetWindow(Windows::UI::Core::CoreWindow ^ window) = Windows::ApplicationModel::Core::IFrameworkView::SetWindow;"); + } + + [Test] + [Category("Field")] + public void Field_CustomAttributeFundamentalType() + { + TestFieldSignature(CppCxTestLibName, "UwpTestWinRtComponentCpp.CustomAttribute1", "Field1", "public: bool Field1;"); + } + + + [Test] + [Category("Field")] + public void Field_CustomAttributуSpecificType() + { + TestFieldSignature(CppCxTestLibName, "UwpTestWinRtComponentCpp.CustomAttribute1", "Field2", "public: Windows::Foundation::HResult Field2;"); + } + + [Test] + [Category("Field")] + public void Field_EnumField() + { + TestFieldSignature(CppCxTestLibName, "UwpTestWinRtComponentCpp.Color1", "Red", "Red"); + } + + [Test] + [Category("Field")] + public void Field_ValueType_String() + { + TestFieldSignature(CppCxTestLibName, "Namespace2.Class4", "StringField", "public: Platform::String ^ StringField;"); + } + + [Test] + [Category("Event")] + public void Event_Class1_primeFoundEvent() + { + TestEventSignature(CppCxTestLibName, "UwpTestWinRtComponentCpp.Class1", "primeFoundEvent", @"public: + event UwpTestWinRtComponentCpp::PrimeFoundHandler ^ primeFoundEvent;"); + } + + [Test] + [Category("Properties")] + public void Property_FundamentalType() + { + TestPropertySignature(CppCxTestLibName, "Namespace2.Class3", "LongProperty", @"public: + property long long LongProperty { long long get(); void set(long long value); };"); + } + + [Test] + [Category("Properties")] + public void Property_ArrayOfTypeProperty() + { + TestPropertySignature(CppCxTestLibName, "Namespace2.Class3", "ArrayOfTypeProperty", @"public: + property Platform::Array <Platform::Type ^> ^ ArrayOfTypeProperty { Platform::Array <Platform::Type ^> ^ get(); void set(Platform::Array <Platform::Type ^> ^ value); };"); + } + + [Test] + [Category("Properties")] + public void Property_ArrayOfTypePropertyProtected() + { + TestPropertySignature(CppCxTestLibName, "Namespace2.Class3", "ArrayOfTypePropertyProtected", @"protected: + property Platform::Array <Platform::Type ^> ^ ArrayOfTypePropertyProtected { Platform::Array <Platform::Type ^> ^ get(); void set(Platform::Array <Platform::Type ^> ^ value); };"); + } + + [Test] + [Category("NoSupport")] + public void NoSupport_ParamsKeyword_M6() + { + TestMethodSignature(typeof(Widget), null, "M6"); + } + + [Test] + [Category("NoSupport")] + public void NoSupport_DefaultParameters() + { + TestMethodSignature(CSharpTestLib, "Mono.DocTest.Widget", "Default", null); + } + + [TestFixtureTearDown] + public void TearDown() + { + moduleCash.Clear(); + } + [Test] + [Category("NoSupport")] + public void NoSupport_Exception_NestedClassWithSameName() + { + TestTypeSignature(CSharpTestLib, "Mono.DocTest.Widget/NestedClass", null); + } + } + +} + |