From c843b47d6233153fa961c6d0e61edf7cedf255bb Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Tue, 8 Nov 2022 14:58:05 -0800 Subject: Separate WixInternal content from official WixToolset namespace --- .../NativeAssert.h | 104 --------------------- 1 file changed, 104 deletions(-) delete mode 100644 src/internal/WixBuildTools.TestSupport.Native/NativeAssert.h (limited to 'src/internal/WixBuildTools.TestSupport.Native/NativeAssert.h') diff --git a/src/internal/WixBuildTools.TestSupport.Native/NativeAssert.h b/src/internal/WixBuildTools.TestSupport.Native/NativeAssert.h deleted file mode 100644 index b0206b14..00000000 --- a/src/internal/WixBuildTools.TestSupport.Native/NativeAssert.h +++ /dev/null @@ -1,104 +0,0 @@ -#pragma once -// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. - - -namespace WixBuildTools { -namespace TestSupport { - - using namespace System; - using namespace System::Collections::Generic; - using namespace System::Linq; - using namespace Xunit; - - public ref class NativeAssert : WixAssert - { - public: - static void NotNull(LPCWSTR wz) - { - if (!wz) - { - Assert::NotNull(nullptr); - } - } - - // For some reason, naming these NotStringEqual methods "NotEqual" breaks Intellisense in files that call any overload of the NotEqual method. - static void NotStringEqual(LPCWSTR expected, LPCWSTR actual) - { - NativeAssert::NotStringEqual(expected, actual, FALSE); - } - - static void NotStringEqual(LPCWSTR expected, LPCWSTR actual, BOOL ignoreCase) - { - WixAssert::NotStringEqual(NativeAssert::LPWSTRToString(expected), NativeAssert::LPWSTRToString(actual), ignoreCase); - } - - // For some reason, naming these StringEqual methods "Equal" breaks Intellisense in files that call any overload of the Equal method. - static void StringEqual(LPCWSTR expected, LPCWSTR actual) - { - NativeAssert::StringEqual(expected, actual, FALSE); - } - - static void StringEqual(LPCWSTR expected, LPCWSTR actual, BOOL ignoreCase) - { - WixAssert::StringEqual(NativeAssert::LPWSTRToString(expected), NativeAssert::LPWSTRToString(actual), ignoreCase); - } - - static void Succeeded(HRESULT hr, LPCSTR zFormat, LPCSTR zArg, ... array^ zArgs) - { - array^ formatArgs = gcnew array(zArgs->Length + 1); - formatArgs[0] = NativeAssert::LPSTRToString(zArg); - for (int i = 0; i < zArgs->Length; ++i) - { - formatArgs[i + 1] = NativeAssert::LPSTRToString(zArgs[i]); - } - WixAssert::Succeeded(hr, gcnew String(zFormat), formatArgs); - } - - static void Succeeded(HRESULT hr, LPCSTR zFormat, ... array^ wzArgs) - { - array^ formatArgs = gcnew array(wzArgs->Length); - for (int i = 0; i < wzArgs->Length; ++i) - { - formatArgs[i] = NativeAssert::LPWSTRToString(wzArgs[i]); - } - WixAssert::Succeeded(hr, gcnew String(zFormat), formatArgs); - } - - static void SpecificReturnCode(HRESULT hrExpected, HRESULT hr, LPCSTR zFormat, LPCSTR zArg, ... array^ zArgs) - { - array^ formatArgs = gcnew array(zArgs->Length + 1); - formatArgs[0] = NativeAssert::LPSTRToString(zArg); - for (int i = 0; i < zArgs->Length; ++i) - { - formatArgs[i + 1] = NativeAssert::LPSTRToString(zArgs[i]); - } - WixAssert::SpecificReturnCode(hrExpected, hr, gcnew String(zFormat), formatArgs); - } - - static void SpecificReturnCode(HRESULT hrExpected, HRESULT hr, LPCSTR zFormat, ... array^ wzArgs) - { - array^ formatArgs = gcnew array(wzArgs->Length); - for (int i = 0; i < wzArgs->Length; ++i) - { - formatArgs[i] = NativeAssert::LPWSTRToString(wzArgs[i]); - } - WixAssert::SpecificReturnCode(hrExpected, hr, gcnew String(zFormat), formatArgs); - } - - static void ValidReturnCode(HRESULT hr, ... array^ validReturnCodes) - { - Assert::Contains(hr, (IEnumerable^)validReturnCodes); - } - - private: - static String^ LPSTRToString(LPCSTR z) - { - return z ? gcnew String(z) : nullptr; - } - static String^ LPWSTRToString(LPCWSTR wz) - { - return wz ? gcnew String(wz) : nullptr; - } - }; -} -} -- cgit v1.2.3-55-g6feb