aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2020-07-15 21:31:47 +1000
committerSean Hall <r.sean.hall@gmail.com>2020-07-16 16:44:09 +1000
commite3940e85379b44ab8f68d01cbb6b11db8b0bad77 (patch)
tree7c3853ae2fbbec6381511115fe98bb55632a3d41
parentdc558da002794cc07013e8376f3c55c73391aa0e (diff)
downloadwix-e3940e85379b44ab8f68d01cbb6b11db8b0bad77.tar.gz
wix-e3940e85379b44ab8f68d01cbb6b11db8b0bad77.tar.bz2
wix-e3940e85379b44ab8f68d01cbb6b11db8b0bad77.zip
Update DUtilUnitTest to reference WixBuildTools.TestSupport.Native.
-rw-r--r--src/dutil/dutil.vcxproj4
-rw-r--r--src/dutil/packages.config2
-rw-r--r--src/test/DUtilUnitTest/DUtilUnitTest.vcxproj32
-rw-r--r--src/test/DUtilUnitTest/DUtilUnitTest.vcxproj.filters3
-rw-r--r--src/test/DUtilUnitTest/NativeAssert.h85
-rw-r--r--src/test/DUtilUnitTest/packages.config9
-rw-r--r--src/test/DUtilUnitTest/precomp.h2
7 files changed, 16 insertions, 121 deletions
diff --git a/src/dutil/dutil.vcxproj b/src/dutil/dutil.vcxproj
index 4bae04d6..4dbd2e6b 100644
--- a/src/dutil/dutil.vcxproj
+++ b/src/dutil/dutil.vcxproj
@@ -51,7 +51,7 @@
51 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> 51 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
52 52
53 <ImportGroup Label="Shared"> 53 <ImportGroup Label="Shared">
54 <Import Project="..\..\packages\Nerdbank.GitVersioning.2.0.41\build\Nerdbank.GitVersioning.targets" Condition="Exists('..\..\packages\Nerdbank.GitVersioning.2.0.41\build\Nerdbank.GitVersioning.targets')" /> 54 <Import Project="..\..\packages\Nerdbank.GitVersioning.3.1.91\build\Nerdbank.GitVersioning.targets" Condition="Exists('..\..\packages\Nerdbank.GitVersioning.3.1.91\build\Nerdbank.GitVersioning.targets')" />
55 </ImportGroup> 55 </ImportGroup>
56 56
57 <Import Project="..\NativeMultiTargeting.Build.props" /> 57 <Import Project="..\NativeMultiTargeting.Build.props" />
@@ -196,6 +196,6 @@
196 <PropertyGroup> 196 <PropertyGroup>
197 <ErrorText>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}.</ErrorText> 197 <ErrorText>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}.</ErrorText>
198 </PropertyGroup> 198 </PropertyGroup>
199 <Error Condition="!Exists('..\..\packages\Nerdbank.GitVersioning.2.0.41\build\Nerdbank.GitVersioning.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Nerdbank.GitVersioning.2.0.41\build\Nerdbank.GitVersioning.targets'))" /> 199 <Error Condition="!Exists('..\..\packages\Nerdbank.GitVersioning.3.1.91\build\Nerdbank.GitVersioning.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Nerdbank.GitVersioning.3.1.91\build\Nerdbank.GitVersioning.targets'))" />
200 </Target> 200 </Target>
201</Project> \ No newline at end of file 201</Project> \ No newline at end of file
diff --git a/src/dutil/packages.config b/src/dutil/packages.config
index 764eba29..29fbf9e4 100644
--- a/src/dutil/packages.config
+++ b/src/dutil/packages.config
@@ -1,4 +1,4 @@
1<?xml version="1.0" encoding="utf-8"?> 1<?xml version="1.0" encoding="utf-8"?>
2<packages> 2<packages>
3 <package id="Nerdbank.GitVersioning" version="2.0.41" targetFramework="native" developmentDependency="true" /> 3 <package id="Nerdbank.GitVersioning" version="3.1.91" targetFramework="native" developmentDependency="true" />
4</packages> \ No newline at end of file 4</packages> \ No newline at end of file
diff --git a/src/test/DUtilUnitTest/DUtilUnitTest.vcxproj b/src/test/DUtilUnitTest/DUtilUnitTest.vcxproj
index c0974780..4c660aa9 100644
--- a/src/test/DUtilUnitTest/DUtilUnitTest.vcxproj
+++ b/src/test/DUtilUnitTest/DUtilUnitTest.vcxproj
@@ -3,8 +3,7 @@
3 3
4 4
5<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 5<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
6 <Import Project="..\..\..\packages\xunit.core.2.4.1\build\xunit.core.props" Condition="Exists('..\..\..\packages\xunit.core.2.4.1\build\xunit.core.props')" /> 6 <Import Project="..\..\..\packages\WixBuildTools.TestSupport.Native.4.0.40\build\WixBuildTools.TestSupport.Native.props" Condition="Exists('..\..\..\packages\WixBuildTools.TestSupport.Native.4.0.40\build\WixBuildTools.TestSupport.Native.props')" />
7 <Import Project="..\..\..\packages\xunit.runner.visualstudio.2.4.1\build\net20\xunit.runner.visualstudio.props" Condition="Exists('..\..\..\packages\xunit.runner.visualstudio.2.4.1\build\net20\xunit.runner.visualstudio.props')" />
8 <ItemGroup Label="ProjectConfigurations"> 7 <ItemGroup Label="ProjectConfigurations">
9 <ProjectConfiguration Include="Debug|Win32"> 8 <ProjectConfiguration Include="Debug|Win32">
10 <Configuration>Debug</Configuration> 9 <Configuration>Debug</Configuration>
@@ -21,10 +20,8 @@
21 <RootNamespace>DUtilUnitTests</RootNamespace> 20 <RootNamespace>DUtilUnitTests</RootNamespace>
22 <Keyword>ManagedCProj</Keyword> 21 <Keyword>ManagedCProj</Keyword>
23 <ConfigurationType>DynamicLibrary</ConfigurationType> 22 <ConfigurationType>DynamicLibrary</ConfigurationType>
24 <PlatformToolset>v142</PlatformToolset>
25 <CharacterSet>Unicode</CharacterSet> 23 <CharacterSet>Unicode</CharacterSet>
26 <CLRSupport>true</CLRSupport> 24 <CLRSupport>true</CLRSupport>
27 <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
28 </PropertyGroup> 25 </PropertyGroup>
29 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> 26 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
30 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> 27 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
@@ -46,7 +43,7 @@
46 <ClCompile Include="PathUtilTest.cpp" /> 43 <ClCompile Include="PathUtilTest.cpp" />
47 <ClCompile Include="precomp.cpp"> 44 <ClCompile Include="precomp.cpp">
48 <PrecompiledHeader>Create</PrecompiledHeader> 45 <PrecompiledHeader>Create</PrecompiledHeader>
49 <!-- Warnings from NativeAssert.h from referencing netstandard dlls --> 46 <!-- Warnings from referencing netstandard dlls -->
50 <DisableSpecificWarnings>4564;4691</DisableSpecificWarnings> 47 <DisableSpecificWarnings>4564;4691</DisableSpecificWarnings>
51 </ClCompile> 48 </ClCompile>
52 <ClCompile Include="SceUtilTest.cpp" Condition=" Exists('$(SqlCESdkIncludePath)') " /> 49 <ClCompile Include="SceUtilTest.cpp" Condition=" Exists('$(SqlCESdkIncludePath)') " />
@@ -56,7 +53,6 @@
56 <ItemGroup> 53 <ItemGroup>
57 <ClInclude Include="precomp.h" /> 54 <ClInclude Include="precomp.h" />
58 <ClInclude Include="error.h" /> 55 <ClInclude Include="error.h" />
59 <ClInclude Include="NativeAssert.h" />
60 </ItemGroup> 56 </ItemGroup>
61 <ItemGroup> 57 <ItemGroup>
62 <None Include="packages.config" /> 58 <None Include="packages.config" />
@@ -65,33 +61,23 @@
65 <ItemGroup> 61 <ItemGroup>
66 <Reference Include="System" /> 62 <Reference Include="System" />
67 <Reference Include="System.Core" /> 63 <Reference Include="System.Core" />
68 <Reference Include="xunit.abstractions">
69 <HintPath>..\..\..\packages\xunit.abstractions.2.0.3\lib\netstandard2.0\xunit.abstractions.dll</HintPath>
70 </Reference>
71 <Reference Include="xunit.assert">
72 <HintPath>..\..\..\packages\xunit.assert.2.4.1\lib\netstandard1.1\xunit.assert.dll</HintPath>
73 </Reference>
74 <Reference Include="xunit.core">
75 <HintPath>..\..\..\packages\xunit.extensibility.core.2.4.1\lib\netstandard1.1\xunit.core.dll</HintPath>
76 </Reference>
77 <Reference Include="xunit.execution.desktop">
78 <HintPath>..\..\..\packages\xunit.extensibility.execution.2.4.1\lib\net452\xunit.execution.desktop.dll</HintPath>
79 </Reference>
80 <Reference Include="WixBuildTools.TestSupport"> 64 <Reference Include="WixBuildTools.TestSupport">
81 <HintPath>..\..\..\packages\WixBuildTools.TestSupport.4.0.37\lib\net472\WixBuildTools.TestSupport.dll</HintPath> 65 <HintPath>..\..\..\packages\WixBuildTools.TestSupport.4.0.40\lib\net472\WixBuildTools.TestSupport.dll</HintPath>
66 </Reference>
67 <Reference Include="WixBuildTools.TestSupport.Native">
68 <HintPath>..\..\..\packages\WixBuildTools.TestSupport.Native.4.0.40\lib\net472\WixBuildTools.TestSupport.Native.dll</HintPath>
82 </Reference> 69 </Reference>
83 </ItemGroup> 70 </ItemGroup>
84 <ItemGroup> 71 <ItemGroup>
85 <ProjectReference Include="..\..\dutil\dutil.vcxproj" /> 72 <ProjectReference Include="..\..\dutil\dutil.vcxproj" />
86 </ItemGroup> 73 </ItemGroup>
87 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> 74 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
88 <Import Project="..\..\..\packages\xunit.core.2.4.1\build\xunit.core.targets" Condition="Exists('..\..\..\packages\xunit.core.2.4.1\build\xunit.core.targets')" /> 75 <Import Project="..\..\..\packages\WixBuildTools.TestSupport.Native.4.0.40\build\WixBuildTools.TestSupport.Native.targets" Condition="Exists('..\..\..\packages\WixBuildTools.TestSupport.Native.4.0.40\build\WixBuildTools.TestSupport.Native.targets')" />
89 <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> 76 <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
90 <PropertyGroup> 77 <PropertyGroup>
91 <ErrorText>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}.</ErrorText> 78 <ErrorText>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}.</ErrorText>
92 </PropertyGroup> 79 </PropertyGroup>
93 <Error Condition="!Exists('..\..\..\packages\xunit.core.2.4.1\build\xunit.core.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\xunit.core.2.4.1\build\xunit.core.props'))" /> 80 <Error Condition="!Exists('..\..\..\packages\WixBuildTools.TestSupport.Native.4.0.40\build\WixBuildTools.TestSupport.Native.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\WixBuildTools.TestSupport.Native.4.0.40\build\WixBuildTools.TestSupport.Native.props'))" />
94 <Error Condition="!Exists('..\..\..\packages\xunit.core.2.4.1\build\xunit.core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\xunit.core.2.4.1\build\xunit.core.targets'))" /> 81 <Error Condition="!Exists('..\..\..\packages\WixBuildTools.TestSupport.Native.4.0.40\build\WixBuildTools.TestSupport.Native.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\WixBuildTools.TestSupport.Native.4.0.40\build\WixBuildTools.TestSupport.Native.targets'))" />
95 <Error Condition="!Exists('..\..\..\packages\xunit.runner.visualstudio.2.4.1\build\net20\xunit.runner.visualstudio.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\xunit.runner.visualstudio.2.4.1\build\net20\xunit.runner.visualstudio.props'))" />
96 </Target> 82 </Target>
97</Project> \ No newline at end of file 83</Project> \ No newline at end of file
diff --git a/src/test/DUtilUnitTest/DUtilUnitTest.vcxproj.filters b/src/test/DUtilUnitTest/DUtilUnitTest.vcxproj.filters
index 2456558f..0c83e3fa 100644
--- a/src/test/DUtilUnitTest/DUtilUnitTest.vcxproj.filters
+++ b/src/test/DUtilUnitTest/DUtilUnitTest.vcxproj.filters
@@ -70,8 +70,5 @@
70 <ClInclude Include="error.h"> 70 <ClInclude Include="error.h">
71 <Filter>Header Files</Filter> 71 <Filter>Header Files</Filter>
72 </ClInclude> 72 </ClInclude>
73 <ClInclude Include="NativeAssert.h">
74 <Filter>Header Files</Filter>
75 </ClInclude>
76 </ItemGroup> 73 </ItemGroup>
77</Project> \ No newline at end of file 74</Project> \ No newline at end of file
diff --git a/src/test/DUtilUnitTest/NativeAssert.h b/src/test/DUtilUnitTest/NativeAssert.h
deleted file mode 100644
index 34af4f34..00000000
--- a/src/test/DUtilUnitTest/NativeAssert.h
+++ /dev/null
@@ -1,85 +0,0 @@
1#pragma once
2// 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.
3
4
5namespace WixBuildTools {
6namespace TestSupport {
7
8 using namespace System;
9 using namespace System::Collections::Generic;
10 using namespace System::Linq;
11 using namespace Xunit;
12
13 public ref class NativeAssert : WixAssert
14 {
15 public:
16 static void NotNull(LPCWSTR wz)
17 {
18 if (!wz)
19 {
20 Assert::NotNull(nullptr);
21 }
22 }
23
24 // For some reason, naming these NotStringEqual methods "NotEqual" breaks Intellisense in files that call any overload of the NotEqual method.
25 static void NotStringEqual(LPCWSTR expected, LPCWSTR actual)
26 {
27 NativeAssert::NotStringEqual(expected, actual, FALSE);
28 }
29
30 static void NotStringEqual(LPCWSTR expected, LPCWSTR actual, BOOL ignoreCase)
31 {
32 IEqualityComparer<String^>^ comparer = ignoreCase ? StringComparer::InvariantCultureIgnoreCase : StringComparer::InvariantCulture;
33 Assert::NotEqual(NativeAssert::LPWSTRToString(expected), NativeAssert::LPWSTRToString(actual), comparer);
34 }
35
36 // For some reason, naming these StringEqual methods "Equal" breaks Intellisense in files that call any overload of the Equal method.
37 static void StringEqual(LPCWSTR expected, LPCWSTR actual)
38 {
39 NativeAssert::StringEqual(expected, actual, FALSE);
40 }
41
42 static void StringEqual(LPCWSTR expected, LPCWSTR actual, BOOL ignoreCase)
43 {
44 IEqualityComparer<String^>^ comparer = ignoreCase ? StringComparer::InvariantCultureIgnoreCase : StringComparer::InvariantCulture;
45 Assert::Equal(NativeAssert::LPWSTRToString(expected), NativeAssert::LPWSTRToString(actual), comparer);
46 }
47
48 static void Succeeded(HRESULT hr, LPCSTR zFormat, LPCSTR zArg, ... array<LPCSTR>^ zArgs)
49 {
50 array<Object^>^ formatArgs = gcnew array<Object^, 1>(zArgs->Length + 1);
51 formatArgs[0] = NativeAssert::LPSTRToString(zArg);
52 for (int i = 0; i < zArgs->Length; ++i)
53 {
54 formatArgs[i + 1] = NativeAssert::LPSTRToString(zArgs[i]);
55 }
56 WixAssert::Succeeded(hr, gcnew String(zFormat), formatArgs);
57 }
58
59 static void Succeeded(HRESULT hr, LPCSTR zFormat, ... array<LPCWSTR>^ wzArgs)
60 {
61 array<Object^>^ formatArgs = gcnew array<Object^, 1>(wzArgs->Length);
62 for (int i = 0; i < wzArgs->Length; ++i)
63 {
64 formatArgs[i] = NativeAssert::LPWSTRToString(wzArgs[i]);
65 }
66 WixAssert::Succeeded(hr, gcnew String(zFormat), formatArgs);
67 }
68
69 static void ValidReturnCode(HRESULT hr, ... array<HRESULT>^ validReturnCodes)
70 {
71 Assert::Contains(hr, (IEnumerable<HRESULT>^)validReturnCodes);
72 }
73
74 private:
75 static String^ LPSTRToString(LPCSTR z)
76 {
77 return z ? gcnew String(z) : nullptr;
78 }
79 static String^ LPWSTRToString(LPCWSTR wz)
80 {
81 return wz ? gcnew String(wz) : nullptr;
82 }
83 };
84}
85}
diff --git a/src/test/DUtilUnitTest/packages.config b/src/test/DUtilUnitTest/packages.config
index 96fb423b..44e5fe06 100644
--- a/src/test/DUtilUnitTest/packages.config
+++ b/src/test/DUtilUnitTest/packages.config
@@ -1,7 +1,5 @@
1<?xml version="1.0" encoding="utf-8"?> 1<?xml version="1.0" encoding="utf-8"?>
2<!-- 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. --> 2<!-- 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. -->
3
4
5<packages> 3<packages>
6 <package id="xunit.abstractions" version="2.0.3" /> 4 <package id="xunit.abstractions" version="2.0.3" />
7 <package id="xunit.assert" version="2.4.1" /> 5 <package id="xunit.assert" version="2.4.1" />
@@ -9,5 +7,6 @@
9 <package id="xunit.extensibility.core" version="2.4.1" /> 7 <package id="xunit.extensibility.core" version="2.4.1" />
10 <package id="xunit.extensibility.execution" version="2.4.1" /> 8 <package id="xunit.extensibility.execution" version="2.4.1" />
11 <package id="xunit.runner.visualstudio" version="2.4.1" /> 9 <package id="xunit.runner.visualstudio" version="2.4.1" />
12 <package id="WixBuildTools.TestSupport" version="4.0.37" /> 10 <package id="WixBuildTools.TestSupport" version="4.0.40" />
13</packages> 11 <package id="WixBuildTools.TestSupport.Native" version="4.0.40" />
12</packages> \ No newline at end of file
diff --git a/src/test/DUtilUnitTest/precomp.h b/src/test/DUtilUnitTest/precomp.h
index 284668fe..b3a1a9cb 100644
--- a/src/test/DUtilUnitTest/precomp.h
+++ b/src/test/DUtilUnitTest/precomp.h
@@ -23,7 +23,5 @@
23#include <regutil.h> 23#include <regutil.h>
24#include <uriutil.h> 24#include <uriutil.h>
25 25
26#include "NativeAssert.h"
27
28#pragma managed 26#pragma managed
29#include <vcclr.h> 27#include <vcclr.h>