From 28d73bd6a9ed77b6db17ff1af4a30e8fb5adc9e7 Mon Sep 17 00:00:00 2001 From: Ayush Jaiswal Date: Mon, 16 Dec 2024 18:29:52 +0530 Subject: [PATCH] OAuth2.0 Unit test --- .../OAuthTestApp/OAuthTestApp.vcxproj | 130 ++++++++++++++++++ .../OAuthTestApp/OAuthTestApp.vcxproj.filters | 37 +++++ .../TestApps/OAuthTestApp/PropertySheet.props | 16 +++ test/TestApps/OAuthTestApp/main.cpp | 11 ++ test/TestApps/OAuthTestApp/packages.config | 4 + test/TestApps/OAuthTestApp/pch.cpp | 1 + test/TestApps/OAuthTestApp/pch.h | 3 + test/TestApps/OAuthTestApp/readme.txt | 30 ++++ 8 files changed, 232 insertions(+) create mode 100644 test/TestApps/OAuthTestApp/OAuthTestApp.vcxproj create mode 100644 test/TestApps/OAuthTestApp/OAuthTestApp.vcxproj.filters create mode 100644 test/TestApps/OAuthTestApp/PropertySheet.props create mode 100644 test/TestApps/OAuthTestApp/main.cpp create mode 100644 test/TestApps/OAuthTestApp/packages.config create mode 100644 test/TestApps/OAuthTestApp/pch.cpp create mode 100644 test/TestApps/OAuthTestApp/pch.h create mode 100644 test/TestApps/OAuthTestApp/readme.txt diff --git a/test/TestApps/OAuthTestApp/OAuthTestApp.vcxproj b/test/TestApps/OAuthTestApp/OAuthTestApp.vcxproj new file mode 100644 index 0000000000..f11bb9df45 --- /dev/null +++ b/test/TestApps/OAuthTestApp/OAuthTestApp.vcxproj @@ -0,0 +1,130 @@ + + + + + true + true + true + true + 15.0 + {fb04e734-209c-4f7e-ba1f-40351e1d35ce} + Win32Proj + OAuthTestApp + 10.0.26100.0 + 10.0.17134.0 + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + Application + v143 + v142 + v141 + v140 + Unicode + + + true + true + + + false + true + false + + + + + + + + + + + + + + + + Use + pch.h + $(IntDir)pch.pch + _CONSOLE;WIN32_LEAN_AND_MEAN;WINRT_LEAN_AND_MEAN;%(PreprocessorDefinitions) + Level4 + %(AdditionalOptions) /permissive- /bigobj + + + + + Disabled + _DEBUG;%(PreprocessorDefinitions) + + + Console + false + + + + + WIN32;%(PreprocessorDefinitions) + + + + + MaxSpeed + true + true + NDEBUG;%(PreprocessorDefinitions) + + + Console + true + true + false + + + + + + + + + Create + + + + + + + false + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + \ No newline at end of file diff --git a/test/TestApps/OAuthTestApp/OAuthTestApp.vcxproj.filters b/test/TestApps/OAuthTestApp/OAuthTestApp.vcxproj.filters new file mode 100644 index 0000000000..388ab2e234 --- /dev/null +++ b/test/TestApps/OAuthTestApp/OAuthTestApp.vcxproj.filters @@ -0,0 +1,37 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Header Files + + + + + Source Files + + + Source Files + + + + + + + + + + \ No newline at end of file diff --git a/test/TestApps/OAuthTestApp/PropertySheet.props b/test/TestApps/OAuthTestApp/PropertySheet.props new file mode 100644 index 0000000000..b0c622690f --- /dev/null +++ b/test/TestApps/OAuthTestApp/PropertySheet.props @@ -0,0 +1,16 @@ + + + + + + + + \ No newline at end of file diff --git a/test/TestApps/OAuthTestApp/main.cpp b/test/TestApps/OAuthTestApp/main.cpp new file mode 100644 index 0000000000..d5b806548f --- /dev/null +++ b/test/TestApps/OAuthTestApp/main.cpp @@ -0,0 +1,11 @@ +#include "pch.h" + +using namespace winrt; +using namespace Windows::Foundation; + +int main() +{ + init_apartment(); + Uri uri(L"http://aka.ms/cppwinrt"); + printf("Hello, %ls!\n", uri.AbsoluteUri().c_str()); +} diff --git a/test/TestApps/OAuthTestApp/packages.config b/test/TestApps/OAuthTestApp/packages.config new file mode 100644 index 0000000000..cbf6205e62 --- /dev/null +++ b/test/TestApps/OAuthTestApp/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/test/TestApps/OAuthTestApp/pch.cpp b/test/TestApps/OAuthTestApp/pch.cpp new file mode 100644 index 0000000000..bcb5590be1 --- /dev/null +++ b/test/TestApps/OAuthTestApp/pch.cpp @@ -0,0 +1 @@ +#include "pch.h" diff --git a/test/TestApps/OAuthTestApp/pch.h b/test/TestApps/OAuthTestApp/pch.h new file mode 100644 index 0000000000..2eec5b9225 --- /dev/null +++ b/test/TestApps/OAuthTestApp/pch.h @@ -0,0 +1,3 @@ +#pragma once +#include +#include diff --git a/test/TestApps/OAuthTestApp/readme.txt b/test/TestApps/OAuthTestApp/readme.txt new file mode 100644 index 0000000000..17d67ecada --- /dev/null +++ b/test/TestApps/OAuthTestApp/readme.txt @@ -0,0 +1,30 @@ +======================================================================== + C++/WinRT OAuthTestApp Project Overview +======================================================================== + +This project demonstrates how to get started consuming Windows Runtime +classes directly from standard C++, using platform projection headers +generated from Windows SDK metadata files. + +Steps to generate and consume SDK platform projection: +1. Build project initially to generate platform projection headers into + your Generated Files folder. +2. Include a projection namespace header in your pch.h, such as + . +3. Consume winrt namespace and any Windows Runtime namespaces, such as + winrt::Windows::Foundation, from source code. +4. Initialize apartment via init_apartment() and consume winrt classes. + +Steps to generate and consume a projection from third party metadata: +1. Add a WinMD reference by right-clicking the References project node + and selecting "Add Reference...". In the Add References dialog, + browse to the component WinMD you want to consume and add it. +2. Build the project once to generate projection headers for the + referenced WinMD file under the "Generated Files" subfolder. +3. As above, include projection headers in pch or source code + to consume projected Windows Runtime classes. + +======================================================================== +Learn more about C++/WinRT here: +http://aka.ms/cppwinrt/ +========================================================================