diff --git a/Source/Services/Common/Desktop/pch.h b/Source/Services/Common/Desktop/pch.h index cdfeb3e9..b5d35a6c 100644 --- a/Source/Services/Common/Desktop/pch.h +++ b/Source/Services/Common/Desktop/pch.h @@ -3,9 +3,10 @@ #pragma once -#include "pch_common.h" - #ifdef XSAPI_CPP #undef XSAPI_CPP #endif #define XSAPI_CPP 1 + +#include "pch_common.h" + diff --git a/Tests/UnitTests/Mocks/MockHttpCall.cpp b/Tests/UnitTests/Mocks/MockHttpCall.cpp index 521c8591..deae0852 100644 --- a/Tests/UnitTests/Mocks/MockHttpCall.cpp +++ b/Tests/UnitTests/Mocks/MockHttpCall.cpp @@ -38,6 +38,62 @@ MockHttpCall::get_response( return pplx::task_from_result(ResultValue); } +#if TV_API | XBOX_UWP + +/// +/// Attach the Xbox Live token, sign the request, send the request to the service, and return the response. +/// +pplx::task> +MockHttpCall::get_response_with_auth( + _In_ Windows::Xbox::System::User^ user, + _In_ http_call_response_body_type httpCallResponseBodyType, + _In_ bool allUsersAuthRequired + ) +{ + if (FAILED(ResultHR)) + { + throw ResultHR; + } + CallCounter++; + return pplx::task_from_result(ResultValue); +} + +#elif UNIT_TEST_SERVICES || !XSAPI_CPP + +pplx::task> +MockHttpCall::get_response_with_auth( + _In_ Microsoft::Xbox::Services::System::XboxLiveUser^ user, + _In_ http_call_response_body_type httpCallResponseBodyType, + _In_ bool allUsersAuthRequired + ) +{ + if (FAILED(ResultHR)) + { + throw ResultHR; + } + CallCounter++; + return pplx::task_from_result(ResultValue); +} + +#else + +pplx::task> get_response_with_auth( + _In_ std::shared_ptr user, + _In_ http_call_response_body_type httpCallResponseBodyType, + _In_ bool allUsersAuthRequired + ) +{ + if (FAILED(ResultHR)) + { + throw ResultHR; + } + CallCounter++; + return pplx::task_from_result(ResultValue); +} + +#endif + + pplx::task> MockHttpCall::get_response( _In_ http_call_response_body_type httpCallResponseBodyType, diff --git a/Tests/UnitTests/Mocks/MockHttpCall.h b/Tests/UnitTests/Mocks/MockHttpCall.h index 380b93c9..2f829ba5 100644 --- a/Tests/UnitTests/Mocks/MockHttpCall.h +++ b/Tests/UnitTests/Mocks/MockHttpCall.h @@ -15,6 +15,41 @@ public: _In_ http_call_response_body_type httpCallResponseBodyType ) override; +#if TV_API | XBOX_UWP + + /// + /// Attach the Xbox Live token, sign the request, send the request to the service, and return the response. + /// + virtual pplx::task> get_response_with_auth( + _In_ Windows::Xbox::System::User^ user, + _In_ http_call_response_body_type httpCallResponseBodyType = http_call_response_body_type::json_body, + _In_ bool allUsersAuthRequired = false + ) override; + +#elif UNIT_TEST_SERVICES || !XSAPI_CPP + + /// + /// Attach the Xbox Live token, sign the request, send the request to the service, and return the response. + /// + virtual pplx::task> get_response_with_auth( + _In_ Microsoft::Xbox::Services::System::XboxLiveUser^ user, + _In_ http_call_response_body_type httpCallResponseBodyType = http_call_response_body_type::json_body, + _In_ bool allUsersAuthRequired = false + ) override; + +#else + + /// + /// Attach the Xbox Live token, sign the request, send the request to the service, and return the response. + /// + virtual pplx::task> get_response_with_auth( + _In_ std::shared_ptr user, + _In_ http_call_response_body_type httpCallResponseBodyType = http_call_response_body_type::json_body, + _In_ bool allUsersAuthRequired = false + ) override; + +#endif + virtual pplx::task< std::shared_ptr > get_response( _In_ http_call_response_body_type httpCallResponseBodyType, _In_ const web::http::http_request& httpRequest