diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2020-07-16 16:31:49 +1000 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2020-07-16 16:49:44 +1000 |
commit | ed36894d8b4da2f28972811f39d5e3685964e413 (patch) | |
tree | db8e9c9bc90451ccee08ec4f6a153b2006ef67c8 /src/test | |
parent | 8bcb8c013a258691d4004c50af4689b90dd05c45 (diff) | |
download | wix-ed36894d8b4da2f28972811f39d5e3685964e413.tar.gz wix-ed36894d8b4da2f28972811f39d5e3685964e413.tar.bz2 wix-ed36894d8b4da2f28972811f39d5e3685964e413.zip |
Integrate BurnUnitTest into latest v4.
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/BurnUnitTest/BurnTestFixture.h | 30 | ||||
-rw-r--r-- | src/test/BurnUnitTest/BurnUnitTest.h | 41 | ||||
-rw-r--r-- | src/test/BurnUnitTest/BurnUnitTest.rc | 1 | ||||
-rw-r--r-- | src/test/BurnUnitTest/BurnUnitTest.vcxproj | 44 | ||||
-rw-r--r-- | src/test/BurnUnitTest/CacheTest.cpp | 9 | ||||
-rw-r--r-- | src/test/BurnUnitTest/ElevationTest.cpp | 7 | ||||
-rw-r--r-- | src/test/BurnUnitTest/ManifestTest.cpp | 7 | ||||
-rw-r--r-- | src/test/BurnUnitTest/RegistrationTest.cpp | 41 | ||||
-rw-r--r-- | src/test/BurnUnitTest/SearchTest.cpp | 86 | ||||
-rw-r--r-- | src/test/BurnUnitTest/VariableTest.cpp | 106 | ||||
-rw-r--r-- | src/test/BurnUnitTest/packages.config | 14 | ||||
-rw-r--r-- | src/test/BurnUnitTest/precomp.h | 7 |
12 files changed, 241 insertions, 152 deletions
diff --git a/src/test/BurnUnitTest/BurnTestFixture.h b/src/test/BurnUnitTest/BurnTestFixture.h index b89fe6fa..f158c192 100644 --- a/src/test/BurnUnitTest/BurnTestFixture.h +++ b/src/test/BurnUnitTest/BurnTestFixture.h | |||
@@ -13,8 +13,9 @@ namespace Test | |||
13 | namespace Bootstrapper | 13 | namespace Bootstrapper |
14 | { | 14 | { |
15 | using namespace System; | 15 | using namespace System; |
16 | using namespace WixBuildTools::TestSupport; | ||
16 | 17 | ||
17 | public ref class BurnTestFixture | 18 | public ref class BurnTestFixture : IDisposable |
18 | { | 19 | { |
19 | public: | 20 | public: |
20 | BurnTestFixture() | 21 | BurnTestFixture() |
@@ -26,13 +27,40 @@ namespace Bootstrapper | |||
26 | TestThrowOnFailure(hr, L"Failed to initialize Regutil."); | 27 | TestThrowOnFailure(hr, L"Failed to initialize Regutil."); |
27 | 28 | ||
28 | PlatformInitialize(); | 29 | PlatformInitialize(); |
30 | |||
31 | this->testDirectory = WixBuildTools::TestSupport::TestData::Get(); | ||
32 | |||
33 | LogInitialize(::GetModuleHandleW(NULL)); | ||
34 | |||
35 | hr = LogOpen(NULL, L"BurnUnitTest", NULL, L"txt", FALSE, FALSE, NULL); | ||
36 | TestThrowOnFailure(hr, L"Failed to open log."); | ||
29 | } | 37 | } |
30 | 38 | ||
31 | ~BurnTestFixture() | 39 | ~BurnTestFixture() |
32 | { | 40 | { |
33 | XmlUninitialize(); | 41 | XmlUninitialize(); |
34 | RegUninitialize(); | 42 | RegUninitialize(); |
43 | LogUninitialize(FALSE); | ||
44 | } | ||
45 | |||
46 | property String^ DataDirectory | ||
47 | { | ||
48 | String^ get() | ||
49 | { | ||
50 | return this->testDirectory; | ||
51 | } | ||
35 | } | 52 | } |
53 | |||
54 | property String^ TestDirectory | ||
55 | { | ||
56 | String^ get() | ||
57 | { | ||
58 | return this->testDirectory; | ||
59 | } | ||
60 | } | ||
61 | |||
62 | private: | ||
63 | String^ testDirectory; | ||
36 | }; | 64 | }; |
37 | } | 65 | } |
38 | } | 66 | } |
diff --git a/src/test/BurnUnitTest/BurnUnitTest.h b/src/test/BurnUnitTest/BurnUnitTest.h index a4ca2707..ed1d2956 100644 --- a/src/test/BurnUnitTest/BurnUnitTest.h +++ b/src/test/BurnUnitTest/BurnUnitTest.h | |||
@@ -13,40 +13,33 @@ namespace Test | |||
13 | namespace Bootstrapper | 13 | namespace Bootstrapper |
14 | { | 14 | { |
15 | using namespace System; | 15 | using namespace System; |
16 | using namespace WixTest; | ||
17 | using namespace Xunit; | 16 | using namespace Xunit; |
18 | 17 | ||
19 | public ref class BurnUnitTest : WixTestBase, IUseFixture<BurnTestFixture^> | 18 | [CollectionDefinition("Burn")] |
19 | public ref class BurnCollectionDefinition : ICollectionFixture<BurnTestFixture^> | ||
20 | { | 20 | { |
21 | public: | ||
22 | BurnUnitTest() | ||
23 | { | ||
24 | } | ||
25 | |||
26 | virtual void TestInitialize() override | ||
27 | { | ||
28 | WixTestBase::TestInitialize(); | ||
29 | |||
30 | HRESULT hr = S_OK; | ||
31 | 21 | ||
32 | LogInitialize(::GetModuleHandleW(NULL)); | 22 | }; |
33 | 23 | ||
34 | hr = LogOpen(NULL, L"BurnUnitTest", NULL, L"txt", FALSE, FALSE, NULL); | 24 | [Collection("Burn")] |
35 | TestThrowOnFailure(hr, L"Failed to open log."); | 25 | public ref class BurnUnitTest |
36 | } | 26 | { |
37 | 27 | public: | |
38 | virtual void TestUninitialize() override | 28 | BurnUnitTest(BurnTestFixture^ fixture) |
39 | { | 29 | { |
40 | LogUninitialize(FALSE); | 30 | this->testContext = fixture; |
41 | |||
42 | WixTestBase::TestUninitialize(); | ||
43 | } | 31 | } |
44 | 32 | ||
45 | virtual void SetFixture(BurnTestFixture^ fixture) | 33 | property BurnTestFixture^ TestContext |
46 | { | 34 | { |
47 | // Don't care about the fixture, just need it to be created and disposed. | 35 | BurnTestFixture^ get() |
48 | UNREFERENCED_PARAMETER(fixture); | 36 | { |
37 | return this->testContext; | ||
38 | } | ||
49 | } | 39 | } |
40 | |||
41 | private: | ||
42 | BurnTestFixture^ testContext; | ||
50 | }; | 43 | }; |
51 | } | 44 | } |
52 | } | 45 | } |
diff --git a/src/test/BurnUnitTest/BurnUnitTest.rc b/src/test/BurnUnitTest/BurnUnitTest.rc index 159b0b42..3a815db2 100644 --- a/src/test/BurnUnitTest/BurnUnitTest.rc +++ b/src/test/BurnUnitTest/BurnUnitTest.rc | |||
@@ -4,4 +4,3 @@ | |||
4 | #define VER_ORIGINAL_FILENAME "BurnUnitTest.dll" | 4 | #define VER_ORIGINAL_FILENAME "BurnUnitTest.dll" |
5 | #define VER_INTERNAL_NAME "setup" | 5 | #define VER_INTERNAL_NAME "setup" |
6 | #define VER_FILE_DESCRIPTION "WiX Toolset Bootstrapper unit tests" | 6 | #define VER_FILE_DESCRIPTION "WiX Toolset Bootstrapper unit tests" |
7 | #include "wix.rc" | ||
diff --git a/src/test/BurnUnitTest/BurnUnitTest.vcxproj b/src/test/BurnUnitTest/BurnUnitTest.vcxproj index 5157d0d6..93b3e562 100644 --- a/src/test/BurnUnitTest/BurnUnitTest.vcxproj +++ b/src/test/BurnUnitTest/BurnUnitTest.vcxproj | |||
@@ -2,7 +2,10 @@ | |||
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 | 3 | ||
4 | 4 | ||
5 | <Project DefaultTargets="Build" ToolsVersion="4.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\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\WixToolset.BootstrapperCore.Native.4.0.16\build\WixToolset.BootstrapperCore.Native.props" Condition="Exists('..\..\..\packages\WixToolset.BootstrapperCore.Native.4.0.16\build\WixToolset.BootstrapperCore.Native.props')" /> | ||
8 | <Import Project="..\..\..\packages\WixToolset.DUtil.4.0.45\build\WixToolset.DUtil.props" Condition="Exists('..\..\..\packages\WixToolset.DUtil.4.0.45\build\WixToolset.DUtil.props')" /> | ||
6 | <ItemGroup Label="ProjectConfigurations"> | 9 | <ItemGroup Label="ProjectConfigurations"> |
7 | <ProjectConfiguration Include="Debug|Win32"> | 10 | <ProjectConfiguration Include="Debug|Win32"> |
8 | <Configuration>Debug</Configuration> | 11 | <Configuration>Debug</Configuration> |
@@ -22,19 +25,25 @@ | |||
22 | <CharacterSet>Unicode</CharacterSet> | 25 | <CharacterSet>Unicode</CharacterSet> |
23 | <CLRSupport>true</CLRSupport> | 26 | <CLRSupport>true</CLRSupport> |
24 | </PropertyGroup> | 27 | </PropertyGroup> |
25 | <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), wix.proj))\tools\WixBuild.props" /> | 28 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> |
29 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> | ||
26 | <PropertyGroup> | 30 | <PropertyGroup> |
27 | <ProjectAdditionalIncludeDirectories>$(WixRoot)src\libs\dutil\inc;$(WixRoot)src\burn\inc;$(WixRoot)src\burn\engine;$(WixRoot)src\libs\deputil\inc</ProjectAdditionalIncludeDirectories> | 31 | <ProjectAdditionalIncludeDirectories>..\..\engine</ProjectAdditionalIncludeDirectories> |
28 | <ProjectAdditionalLinkLibraries>cabinet.lib;crypt32.lib;msi.lib;rpcrt4.lib;shlwapi.lib;wininet.lib;wintrust.lib;dutil.lib;deputil.lib;engine.lib;gdiplus.lib</ProjectAdditionalLinkLibraries> | 32 | <ProjectAdditionalLinkLibraries>cabinet.lib;crypt32.lib;msi.lib;rpcrt4.lib;shlwapi.lib;wininet.lib;wintrust.lib;gdiplus.lib</ProjectAdditionalLinkLibraries> |
29 | </PropertyGroup> | 33 | </PropertyGroup> |
30 | <ItemGroup> | 34 | <ItemGroup> |
31 | <ClCompile Include="AssemblyInfo.cpp" /> | 35 | <ClCompile Include="AssemblyInfo.cpp" /> |
36 | <ClCompile Include="CacheTest.cpp" /> | ||
32 | <ClCompile Include="ElevationTest.cpp" /> | 37 | <ClCompile Include="ElevationTest.cpp" /> |
33 | <ClCompile Include="ManifestHelpers.cpp" /> | 38 | <ClCompile Include="ManifestHelpers.cpp" /> |
34 | <ClCompile Include="ManifestTest.cpp" /> | 39 | <ClCompile Include="ManifestTest.cpp" /> |
40 | <ClCompile Include="precomp.cpp"> | ||
41 | <PrecompiledHeader>Create</PrecompiledHeader> | ||
42 | <!-- Warnings from referencing netstandard dlls --> | ||
43 | <DisableSpecificWarnings>4564;4691</DisableSpecificWarnings> | ||
44 | </ClCompile> | ||
35 | <ClCompile Include="RegistrationTest.cpp" /> | 45 | <ClCompile Include="RegistrationTest.cpp" /> |
36 | <ClCompile Include="SearchTest.cpp" /> | 46 | <ClCompile Include="SearchTest.cpp" /> |
37 | <ClCompile Include="CacheTest.cpp" /> | ||
38 | <ClCompile Include="VariableHelpers.cpp" /> | 47 | <ClCompile Include="VariableHelpers.cpp" /> |
39 | <ClCompile Include="VariableTest.cpp" /> | 48 | <ClCompile Include="VariableTest.cpp" /> |
40 | </ItemGroup> | 49 | </ItemGroup> |
@@ -47,14 +56,31 @@ | |||
47 | <ClInclude Include="VariableHelpers.h" /> | 56 | <ClInclude Include="VariableHelpers.h" /> |
48 | </ItemGroup> | 57 | </ItemGroup> |
49 | <ItemGroup> | 58 | <ItemGroup> |
59 | <None Include="packages.config" /> | ||
50 | <ResourceCompile Include="BurnUnitTest.rc" /> | 60 | <ResourceCompile Include="BurnUnitTest.rc" /> |
51 | </ItemGroup> | 61 | </ItemGroup> |
52 | <ItemGroup> | 62 | <ItemGroup> |
53 | <Reference Include="System" /> | 63 | <Reference Include="System" /> |
54 | <ProjectReference Include="..\..\WixTestTools\WixTestTools.csproj" /> | 64 | <Reference Include="System.Core" /> |
55 | <Reference Include="xunit, Version=1.9.2.1705, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL"> | 65 | <Reference Include="WixBuildTools.TestSupport"> |
56 | <HintPath>$(XunitPath)\xunit.dll</HintPath> | 66 | <HintPath>..\..\..\packages\WixBuildTools.TestSupport.4.0.40\lib\net472\WixBuildTools.TestSupport.dll</HintPath> |
67 | </Reference> | ||
68 | <Reference Include="WixBuildTools.TestSupport.Native"> | ||
69 | <HintPath>..\..\..\packages\WixBuildTools.TestSupport.Native.4.0.40\lib\net472\WixBuildTools.TestSupport.Native.dll</HintPath> | ||
57 | </Reference> | 70 | </Reference> |
58 | </ItemGroup> | 71 | </ItemGroup> |
59 | <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), wix.proj))\tools\WixBuild.targets" /> | 72 | <ItemGroup> |
73 | <ProjectReference Include="..\..\engine\engine.vcxproj" /> | ||
74 | </ItemGroup> | ||
75 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | ||
76 | <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')" /> | ||
77 | <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> | ||
78 | <PropertyGroup> | ||
79 | <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> | ||
80 | </PropertyGroup> | ||
81 | <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'))" /> | ||
82 | <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'))" /> | ||
83 | <Error Condition="!Exists('..\..\..\packages\WixToolset.BootstrapperCore.Native.4.0.16\build\WixToolset.BootstrapperCore.Native.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\WixToolset.BootstrapperCore.Native.4.0.16\build\WixToolset.BootstrapperCore.Native.props'))" /> | ||
84 | <Error Condition="!Exists('..\..\..\packages\WixToolset.DUtil.4.0.45\build\WixToolset.DUtil.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\WixToolset.DUtil.4.0.45\build\WixToolset.DUtil.props'))" /> | ||
85 | </Target> | ||
60 | </Project> | 86 | </Project> |
diff --git a/src/test/BurnUnitTest/CacheTest.cpp b/src/test/BurnUnitTest/CacheTest.cpp index 9b3c6e64..6d261842 100644 --- a/src/test/BurnUnitTest/CacheTest.cpp +++ b/src/test/BurnUnitTest/CacheTest.cpp | |||
@@ -15,13 +15,16 @@ namespace Bootstrapper | |||
15 | { | 15 | { |
16 | using namespace System; | 16 | using namespace System; |
17 | using namespace System::IO; | 17 | using namespace System::IO; |
18 | using namespace WixTest; | ||
19 | using namespace Xunit; | 18 | using namespace Xunit; |
20 | 19 | ||
21 | public ref class CacheTest : BurnUnitTest | 20 | public ref class CacheTest : BurnUnitTest |
22 | { | 21 | { |
23 | public: | 22 | public: |
24 | [NamedFact] | 23 | CacheTest(BurnTestFixture^ fixture) : BurnUnitTest(fixture) |
24 | { | ||
25 | } | ||
26 | |||
27 | [Fact(Skip = "Currently fails")] | ||
25 | void CacheSignatureTest() | 28 | void CacheSignatureTest() |
26 | { | 29 | { |
27 | HRESULT hr = S_OK; | 30 | HRESULT hr = S_OK; |
@@ -33,7 +36,7 @@ namespace Bootstrapper | |||
33 | 36 | ||
34 | try | 37 | try |
35 | { | 38 | { |
36 | pin_ptr<const wchar_t> dataDirectory = PtrToStringChars(TestContext->DataDirectory); | 39 | pin_ptr<const wchar_t> dataDirectory = PtrToStringChars(this->TestContext->DataDirectory); |
37 | hr = PathConcat(dataDirectory, L"BurnTestPayloads\\Products\\TestExe\\TestExe.exe", &sczPayloadPath); | 40 | hr = PathConcat(dataDirectory, L"BurnTestPayloads\\Products\\TestExe\\TestExe.exe", &sczPayloadPath); |
38 | Assert::True(S_OK == hr, "Failed to get path to test file."); | 41 | Assert::True(S_OK == hr, "Failed to get path to test file."); |
39 | Assert::True(FileExistsEx(sczPayloadPath, NULL), "Test file does not exist."); | 42 | Assert::True(FileExistsEx(sczPayloadPath, NULL), "Test file does not exist."); |
diff --git a/src/test/BurnUnitTest/ElevationTest.cpp b/src/test/BurnUnitTest/ElevationTest.cpp index bb10ce43..3d144128 100644 --- a/src/test/BurnUnitTest/ElevationTest.cpp +++ b/src/test/BurnUnitTest/ElevationTest.cpp | |||
@@ -39,13 +39,16 @@ namespace Bootstrapper | |||
39 | using namespace System; | 39 | using namespace System; |
40 | using namespace System::IO; | 40 | using namespace System::IO; |
41 | using namespace System::Threading; | 41 | using namespace System::Threading; |
42 | using namespace WixTest; | ||
43 | using namespace Xunit; | 42 | using namespace Xunit; |
44 | 43 | ||
45 | public ref class ElevationTest : BurnUnitTest | 44 | public ref class ElevationTest : BurnUnitTest |
46 | { | 45 | { |
47 | public: | 46 | public: |
48 | [NamedFact] | 47 | ElevationTest(BurnTestFixture^ fixture) : BurnUnitTest(fixture) |
48 | { | ||
49 | } | ||
50 | |||
51 | [Fact] | ||
49 | void ElevateTest() | 52 | void ElevateTest() |
50 | { | 53 | { |
51 | HRESULT hr = S_OK; | 54 | HRESULT hr = S_OK; |
diff --git a/src/test/BurnUnitTest/ManifestTest.cpp b/src/test/BurnUnitTest/ManifestTest.cpp index 14ead82e..963be156 100644 --- a/src/test/BurnUnitTest/ManifestTest.cpp +++ b/src/test/BurnUnitTest/ManifestTest.cpp | |||
@@ -13,13 +13,16 @@ namespace Test | |||
13 | namespace Bootstrapper | 13 | namespace Bootstrapper |
14 | { | 14 | { |
15 | using namespace System; | 15 | using namespace System; |
16 | using namespace WixTest; | ||
17 | using namespace Xunit; | 16 | using namespace Xunit; |
18 | 17 | ||
19 | public ref class ManifestTest : BurnUnitTest | 18 | public ref class ManifestTest : BurnUnitTest |
20 | { | 19 | { |
21 | public: | 20 | public: |
22 | [NamedFact] | 21 | ManifestTest(BurnTestFixture^ fixture) : BurnUnitTest(fixture) |
22 | { | ||
23 | } | ||
24 | |||
25 | [Fact] | ||
23 | void ManifestLoadXmlTest() | 26 | void ManifestLoadXmlTest() |
24 | { | 27 | { |
25 | HRESULT hr = S_OK; | 28 | HRESULT hr = S_OK; |
diff --git a/src/test/BurnUnitTest/RegistrationTest.cpp b/src/test/BurnUnitTest/RegistrationTest.cpp index 1ab6b8e9..9c7bf4ce 100644 --- a/src/test/BurnUnitTest/RegistrationTest.cpp +++ b/src/test/BurnUnitTest/RegistrationTest.cpp | |||
@@ -51,13 +51,16 @@ namespace Bootstrapper | |||
51 | using namespace Microsoft::Win32; | 51 | using namespace Microsoft::Win32; |
52 | using namespace System; | 52 | using namespace System; |
53 | using namespace System::IO; | 53 | using namespace System::IO; |
54 | using namespace WixTest; | ||
55 | using namespace Xunit; | 54 | using namespace Xunit; |
56 | 55 | ||
57 | public ref class RegistrationTest : BurnUnitTest | 56 | public ref class RegistrationTest : BurnUnitTest |
58 | { | 57 | { |
59 | public: | 58 | public: |
60 | [NamedFact] | 59 | RegistrationTest(BurnTestFixture^ fixture) : BurnUnitTest(fixture) |
60 | { | ||
61 | } | ||
62 | |||
63 | [Fact] | ||
61 | void RegisterBasicTest() | 64 | void RegisterBasicTest() |
62 | { | 65 | { |
63 | HRESULT hr = S_OK; | 66 | HRESULT hr = S_OK; |
@@ -115,7 +118,7 @@ namespace Bootstrapper | |||
115 | Assert::True(File::Exists(Path::Combine(cacheDirectory, gcnew String(L"setup.exe")))); | 118 | Assert::True(File::Exists(Path::Combine(cacheDirectory, gcnew String(L"setup.exe")))); |
116 | 119 | ||
117 | Assert::Equal(Int32(BURN_RESUME_MODE_ACTIVE), (Int32)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"Resume"), nullptr)); | 120 | Assert::Equal(Int32(BURN_RESUME_MODE_ACTIVE), (Int32)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"Resume"), nullptr)); |
118 | Assert::Equal(String::Concat(L"\"", Path::Combine(cacheDirectory, gcnew String(L"setup.exe")), L"\" /burn.runonce"), (String^)(Registry::GetValue(gcnew String(TEST_RUN_KEY), gcnew String(L"{D54F896D-1952-43e6-9C67-B5652240618C}"), nullptr))); | 121 | Assert::Equal<String^>(String::Concat(L"\"", Path::Combine(cacheDirectory, gcnew String(L"setup.exe")), L"\" /burn.runonce"), (String^)(Registry::GetValue(gcnew String(TEST_RUN_KEY), gcnew String(L"{D54F896D-1952-43e6-9C67-B5652240618C}"), nullptr))); |
119 | 122 | ||
120 | // end session | 123 | // end session |
121 | hr = RegistrationSessionEnd(®istration, BURN_RESUME_MODE_NONE, BOOTSTRAPPER_APPLY_RESTART_NONE, BURN_DEPENDENCY_REGISTRATION_ACTION_UNREGISTER); | 124 | hr = RegistrationSessionEnd(®istration, BURN_RESUME_MODE_NONE, BOOTSTRAPPER_APPLY_RESTART_NONE, BURN_DEPENDENCY_REGISTRATION_ACTION_UNREGISTER); |
@@ -145,7 +148,7 @@ namespace Bootstrapper | |||
145 | } | 148 | } |
146 | } | 149 | } |
147 | 150 | ||
148 | [NamedFact] | 151 | [Fact] |
149 | void RegisterArpMinimumTest() | 152 | void RegisterArpMinimumTest() |
150 | { | 153 | { |
151 | HRESULT hr = S_OK; | 154 | HRESULT hr = S_OK; |
@@ -204,7 +207,7 @@ namespace Bootstrapper | |||
204 | 207 | ||
205 | // verify that registration was created | 208 | // verify that registration was created |
206 | Assert::Equal(Int32(BURN_RESUME_MODE_ACTIVE), (Int32)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"Resume"), nullptr)); | 209 | Assert::Equal(Int32(BURN_RESUME_MODE_ACTIVE), (Int32)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"Resume"), nullptr)); |
207 | Assert::Equal(String::Concat(L"\"", Path::Combine(cacheDirectory, gcnew String(L"setup.exe")), L"\" /burn.runonce"), (String^)Registry::GetValue(gcnew String(TEST_RUN_KEY), gcnew String(L"{D54F896D-1952-43e6-9C67-B5652240618C}"), nullptr)); | 210 | Assert::Equal<String^>(String::Concat(L"\"", Path::Combine(cacheDirectory, gcnew String(L"setup.exe")), L"\" /burn.runonce"), (String^)Registry::GetValue(gcnew String(TEST_RUN_KEY), gcnew String(L"{D54F896D-1952-43e6-9C67-B5652240618C}"), nullptr)); |
208 | 211 | ||
209 | // complete registration | 212 | // complete registration |
210 | hr = RegistrationSessionEnd(®istration, BURN_RESUME_MODE_ARP, BOOTSTRAPPER_APPLY_RESTART_NONE, BURN_DEPENDENCY_REGISTRATION_ACTION_REGISTER); | 213 | hr = RegistrationSessionEnd(®istration, BURN_RESUME_MODE_ARP, BOOTSTRAPPER_APPLY_RESTART_NONE, BURN_DEPENDENCY_REGISTRATION_ACTION_REGISTER); |
@@ -226,7 +229,7 @@ namespace Bootstrapper | |||
226 | // verify that registration was updated | 229 | // verify that registration was updated |
227 | Assert::Equal(Int32(BURN_RESUME_MODE_ACTIVE), (Int32)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"Resume"), nullptr)); | 230 | Assert::Equal(Int32(BURN_RESUME_MODE_ACTIVE), (Int32)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"Resume"), nullptr)); |
228 | Assert::Equal(1, (Int32)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"Installed"), nullptr)); | 231 | Assert::Equal(1, (Int32)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"Installed"), nullptr)); |
229 | Assert::Equal(String::Concat(L"\"", Path::Combine(cacheDirectory, gcnew String(L"setup.exe")), L"\" /burn.runonce"), (String^)Registry::GetValue(gcnew String(TEST_RUN_KEY), gcnew String(L"{D54F896D-1952-43e6-9C67-B5652240618C}"), nullptr)); | 232 | Assert::Equal<String^>(String::Concat(L"\"", Path::Combine(cacheDirectory, gcnew String(L"setup.exe")), L"\" /burn.runonce"), (String^)Registry::GetValue(gcnew String(TEST_RUN_KEY), gcnew String(L"{D54F896D-1952-43e6-9C67-B5652240618C}"), nullptr)); |
230 | 233 | ||
231 | // delete registration | 234 | // delete registration |
232 | hr = RegistrationSessionEnd(®istration, BURN_RESUME_MODE_NONE, BOOTSTRAPPER_APPLY_RESTART_NONE, BURN_DEPENDENCY_REGISTRATION_ACTION_UNREGISTER); | 235 | hr = RegistrationSessionEnd(®istration, BURN_RESUME_MODE_NONE, BOOTSTRAPPER_APPLY_RESTART_NONE, BURN_DEPENDENCY_REGISTRATION_ACTION_UNREGISTER); |
@@ -255,7 +258,7 @@ namespace Bootstrapper | |||
255 | } | 258 | } |
256 | } | 259 | } |
257 | 260 | ||
258 | [NamedFact] | 261 | [Fact] |
259 | void RegisterArpFullTest() | 262 | void RegisterArpFullTest() |
260 | { | 263 | { |
261 | HRESULT hr = S_OK; | 264 | HRESULT hr = S_OK; |
@@ -316,7 +319,7 @@ namespace Bootstrapper | |||
316 | 319 | ||
317 | // verify that registration was created | 320 | // verify that registration was created |
318 | Assert::Equal(Int32(BURN_RESUME_MODE_ACTIVE), (Int32)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"Resume"), nullptr)); | 321 | Assert::Equal(Int32(BURN_RESUME_MODE_ACTIVE), (Int32)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"Resume"), nullptr)); |
319 | Assert::Equal(String::Concat(L"\"", Path::Combine(cacheDirectory, gcnew String(L"setup.exe")), L"\" /burn.runonce"), (String^)Registry::GetValue(gcnew String(TEST_RUN_KEY), gcnew String(L"{D54F896D-1952-43e6-9C67-B5652240618C}"), nullptr)); | 322 | Assert::Equal<String^>(String::Concat(L"\"", Path::Combine(cacheDirectory, gcnew String(L"setup.exe")), L"\" /burn.runonce"), (String^)Registry::GetValue(gcnew String(TEST_RUN_KEY), gcnew String(L"{D54F896D-1952-43e6-9C67-B5652240618C}"), nullptr)); |
320 | 323 | ||
321 | // finish registration | 324 | // finish registration |
322 | hr = RegistrationSessionEnd(®istration, BURN_RESUME_MODE_ARP, BOOTSTRAPPER_APPLY_RESTART_NONE, BURN_DEPENDENCY_REGISTRATION_ACTION_REGISTER); | 325 | hr = RegistrationSessionEnd(®istration, BURN_RESUME_MODE_ARP, BOOTSTRAPPER_APPLY_RESTART_NONE, BURN_DEPENDENCY_REGISTRATION_ACTION_REGISTER); |
@@ -327,15 +330,15 @@ namespace Bootstrapper | |||
327 | Assert::Equal(1, (Int32)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"Installed"), nullptr)); | 330 | Assert::Equal(1, (Int32)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"Installed"), nullptr)); |
328 | Assert::Equal((Object^)nullptr, Registry::GetValue(gcnew String(TEST_RUN_KEY), gcnew String(L"{D54F896D-1952-43e6-9C67-B5652240618C}"), nullptr)); | 331 | Assert::Equal((Object^)nullptr, Registry::GetValue(gcnew String(TEST_RUN_KEY), gcnew String(L"{D54F896D-1952-43e6-9C67-B5652240618C}"), nullptr)); |
329 | 332 | ||
330 | Assert::Equal(gcnew String(L"DisplayName1"), (String^)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"DisplayName"), nullptr)); | 333 | Assert::Equal<String^>(gcnew String(L"DisplayName1"), (String^)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"DisplayName"), nullptr)); |
331 | Assert::Equal(gcnew String(L"1.2.3.4"), (String^)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"DisplayVersion"), nullptr)); | 334 | Assert::Equal<String^>(gcnew String(L"1.2.3.4"), (String^)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"DisplayVersion"), nullptr)); |
332 | Assert::Equal(gcnew String(L"Publisher1"), (String^)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"Publisher"), nullptr)); | 335 | Assert::Equal<String^>(gcnew String(L"Publisher1"), (String^)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"Publisher"), nullptr)); |
333 | Assert::Equal(gcnew String(L"http://www.microsoft.com/help"), (String^)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"HelpLink"), nullptr)); | 336 | Assert::Equal<String^>(gcnew String(L"http://www.microsoft.com/help"), (String^)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"HelpLink"), nullptr)); |
334 | Assert::Equal(gcnew String(L"555-555-5555"), (String^)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"HelpTelephone"), nullptr)); | 337 | Assert::Equal<String^>(gcnew String(L"555-555-5555"), (String^)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"HelpTelephone"), nullptr)); |
335 | Assert::Equal(gcnew String(L"http://www.microsoft.com/about"), (String^)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"URLInfoAbout"), nullptr)); | 338 | Assert::Equal<String^>(gcnew String(L"http://www.microsoft.com/about"), (String^)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"URLInfoAbout"), nullptr)); |
336 | Assert::Equal(gcnew String(L"http://www.microsoft.com/update"), (String^)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"URLUpdateInfo"), nullptr)); | 339 | Assert::Equal<String^>(gcnew String(L"http://www.microsoft.com/update"), (String^)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"URLUpdateInfo"), nullptr)); |
337 | Assert::Equal(gcnew String(L"Comments1"), (String^)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"Comments"), nullptr)); | 340 | Assert::Equal<String^>(gcnew String(L"Comments1"), (String^)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"Comments"), nullptr)); |
338 | Assert::Equal(gcnew String(L"Contact1"), (String^)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"Contact"), nullptr)); | 341 | Assert::Equal<String^>(gcnew String(L"Contact1"), (String^)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"Contact"), nullptr)); |
339 | Assert::Equal(1, (Int32)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"NoModify"), nullptr)); | 342 | Assert::Equal(1, (Int32)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"NoModify"), nullptr)); |
340 | Assert::Equal(1, (Int32)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"NoRemove"), nullptr)); | 343 | Assert::Equal(1, (Int32)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"NoRemove"), nullptr)); |
341 | 344 | ||
@@ -349,7 +352,7 @@ namespace Bootstrapper | |||
349 | 352 | ||
350 | // verify that registration was updated | 353 | // verify that registration was updated |
351 | Assert::Equal(Int32(BURN_RESUME_MODE_ACTIVE), (Int32)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"Resume"), nullptr)); | 354 | Assert::Equal(Int32(BURN_RESUME_MODE_ACTIVE), (Int32)Registry::GetValue(gcnew String(TEST_UNINSTALL_KEY), gcnew String(L"Resume"), nullptr)); |
352 | Assert::Equal(String::Concat(L"\"", Path::Combine(cacheDirectory, gcnew String(L"setup.exe")), L"\" /burn.runonce"), (String^)Registry::GetValue(gcnew String(TEST_RUN_KEY), gcnew String(L"{D54F896D-1952-43e6-9C67-B5652240618C}"), nullptr)); | 355 | Assert::Equal<String^>(String::Concat(L"\"", Path::Combine(cacheDirectory, gcnew String(L"setup.exe")), L"\" /burn.runonce"), (String^)Registry::GetValue(gcnew String(TEST_RUN_KEY), gcnew String(L"{D54F896D-1952-43e6-9C67-B5652240618C}"), nullptr)); |
353 | 356 | ||
354 | // delete registration | 357 | // delete registration |
355 | hr = RegistrationSessionEnd(®istration, BURN_RESUME_MODE_NONE, BOOTSTRAPPER_APPLY_RESTART_NONE, BURN_DEPENDENCY_REGISTRATION_ACTION_UNREGISTER); | 358 | hr = RegistrationSessionEnd(®istration, BURN_RESUME_MODE_NONE, BOOTSTRAPPER_APPLY_RESTART_NONE, BURN_DEPENDENCY_REGISTRATION_ACTION_UNREGISTER); |
@@ -378,7 +381,7 @@ namespace Bootstrapper | |||
378 | } | 381 | } |
379 | } | 382 | } |
380 | 383 | ||
381 | [NamedFact] | 384 | [Fact(Skip = "Currently fails")] |
382 | void ResumeTest() | 385 | void ResumeTest() |
383 | { | 386 | { |
384 | HRESULT hr = S_OK; | 387 | HRESULT hr = S_OK; |
diff --git a/src/test/BurnUnitTest/SearchTest.cpp b/src/test/BurnUnitTest/SearchTest.cpp index d03db84c..48ab60aa 100644 --- a/src/test/BurnUnitTest/SearchTest.cpp +++ b/src/test/BurnUnitTest/SearchTest.cpp | |||
@@ -46,13 +46,18 @@ namespace Bootstrapper | |||
46 | public ref class SearchTest : BurnUnitTest | 46 | public ref class SearchTest : BurnUnitTest |
47 | { | 47 | { |
48 | public: | 48 | public: |
49 | [NamedFact] | 49 | SearchTest(BurnTestFixture^ fixture) : BurnUnitTest(fixture) |
50 | { | ||
51 | } | ||
52 | |||
53 | [Fact] | ||
50 | void DirectorySearchTest() | 54 | void DirectorySearchTest() |
51 | { | 55 | { |
52 | HRESULT hr = S_OK; | 56 | HRESULT hr = S_OK; |
53 | IXMLDOMElement* pixeBundle = NULL; | 57 | IXMLDOMElement* pixeBundle = NULL; |
54 | BURN_VARIABLES variables = { }; | 58 | BURN_VARIABLES variables = { }; |
55 | BURN_SEARCHES searches = { }; | 59 | BURN_SEARCHES searches = { }; |
60 | BURN_EXTENSIONS burnExtensions = { }; | ||
56 | try | 61 | try |
57 | { | 62 | { |
58 | hr = VariableInitialize(&variables); | 63 | hr = VariableInitialize(&variables); |
@@ -73,7 +78,7 @@ namespace Bootstrapper | |||
73 | // load XML document | 78 | // load XML document |
74 | LoadBundleXmlHelper(wzDocument, &pixeBundle); | 79 | LoadBundleXmlHelper(wzDocument, &pixeBundle); |
75 | 80 | ||
76 | hr = SearchesParseFromXml(&searches, pixeBundle); | 81 | hr = SearchesParseFromXml(&searches, &burnExtensions, pixeBundle); |
77 | TestThrowOnFailure(hr, L"Failed to parse searches from XML."); | 82 | TestThrowOnFailure(hr, L"Failed to parse searches from XML."); |
78 | 83 | ||
79 | // execute searches | 84 | // execute searches |
@@ -92,13 +97,14 @@ namespace Bootstrapper | |||
92 | } | 97 | } |
93 | } | 98 | } |
94 | 99 | ||
95 | [NamedFact] | 100 | [Fact(Skip = "Currently fails")] |
96 | void FileSearchTest() | 101 | void FileSearchTest() |
97 | { | 102 | { |
98 | HRESULT hr = S_OK; | 103 | HRESULT hr = S_OK; |
99 | IXMLDOMElement* pixeBundle = NULL; | 104 | IXMLDOMElement* pixeBundle = NULL; |
100 | BURN_VARIABLES variables = { }; | 105 | BURN_VARIABLES variables = { }; |
101 | BURN_SEARCHES searches = { }; | 106 | BURN_SEARCHES searches = { }; |
107 | BURN_EXTENSIONS burnExtensions = { }; | ||
102 | ULARGE_INTEGER uliVersion = { }; | 108 | ULARGE_INTEGER uliVersion = { }; |
103 | try | 109 | try |
104 | { | 110 | { |
@@ -124,7 +130,7 @@ namespace Bootstrapper | |||
124 | // load XML document | 130 | // load XML document |
125 | LoadBundleXmlHelper(wzDocument, &pixeBundle); | 131 | LoadBundleXmlHelper(wzDocument, &pixeBundle); |
126 | 132 | ||
127 | hr = SearchesParseFromXml(&searches, pixeBundle); | 133 | hr = SearchesParseFromXml(&searches, &burnExtensions, pixeBundle); |
128 | TestThrowOnFailure(hr, L"Failed to parse searches from XML."); | 134 | TestThrowOnFailure(hr, L"Failed to parse searches from XML."); |
129 | 135 | ||
130 | // execute searches | 136 | // execute searches |
@@ -144,13 +150,14 @@ namespace Bootstrapper | |||
144 | } | 150 | } |
145 | } | 151 | } |
146 | 152 | ||
147 | [NamedFact] | 153 | [Fact] |
148 | void RegistrySearchTest() | 154 | void RegistrySearchTest() |
149 | { | 155 | { |
150 | HRESULT hr = S_OK; | 156 | HRESULT hr = S_OK; |
151 | IXMLDOMElement* pixeBundle = NULL; | 157 | IXMLDOMElement* pixeBundle = NULL; |
152 | BURN_VARIABLES variables = { }; | 158 | BURN_VARIABLES variables = { }; |
153 | BURN_SEARCHES searches = { }; | 159 | BURN_SEARCHES searches = { }; |
160 | BURN_EXTENSIONS burnExtensions = { }; | ||
154 | HKEY hkey32 = NULL; | 161 | HKEY hkey32 = NULL; |
155 | HKEY hkey64 = NULL; | 162 | HKEY hkey64 = NULL; |
156 | BOOL f64bitMachine = (nullptr != Environment::GetEnvironmentVariable("ProgramFiles(x86)")); | 163 | BOOL f64bitMachine = (nullptr != Environment::GetEnvironmentVariable("ProgramFiles(x86)")); |
@@ -219,7 +226,7 @@ namespace Bootstrapper | |||
219 | // load XML document | 226 | // load XML document |
220 | LoadBundleXmlHelper(wzDocument, &pixeBundle); | 227 | LoadBundleXmlHelper(wzDocument, &pixeBundle); |
221 | 228 | ||
222 | hr = SearchesParseFromXml(&searches, pixeBundle); | 229 | hr = SearchesParseFromXml(&searches, &burnExtensions, pixeBundle); |
223 | TestThrowOnFailure(hr, L"Failed to parse searches from XML."); | 230 | TestThrowOnFailure(hr, L"Failed to parse searches from XML."); |
224 | 231 | ||
225 | // execute searches | 232 | // execute searches |
@@ -231,31 +238,31 @@ namespace Bootstrapper | |||
231 | Assert::Equal(0ll, VariableGetNumericHelper(&variables, L"Variable2")); | 238 | Assert::Equal(0ll, VariableGetNumericHelper(&variables, L"Variable2")); |
232 | Assert::Equal(0ll, VariableGetNumericHelper(&variables, L"Variable3")); | 239 | Assert::Equal(0ll, VariableGetNumericHelper(&variables, L"Variable3")); |
233 | Assert::Equal(1ll, VariableGetNumericHelper(&variables, L"Variable4")); | 240 | Assert::Equal(1ll, VariableGetNumericHelper(&variables, L"Variable4")); |
234 | Assert::Equal(gcnew String(L"String1 %TEMP%"), VariableGetStringHelper(&variables, L"Variable5")); | 241 | Assert::Equal<String^>(gcnew String(L"String1 %TEMP%"), VariableGetStringHelper(&variables, L"Variable5")); |
235 | Assert::Equal(gcnew String(L"String1 %TEMP%"), VariableGetStringHelper(&variables, L"Variable6")); | 242 | Assert::Equal<String^>(gcnew String(L"String1 %TEMP%"), VariableGetStringHelper(&variables, L"Variable6")); |
236 | Assert::Equal(gcnew String(L"String1 %TEMP%"), VariableGetStringHelper(&variables, L"Variable7")); | 243 | Assert::Equal<String^>(gcnew String(L"String1 %TEMP%"), VariableGetStringHelper(&variables, L"Variable7")); |
237 | Assert::Equal(gcnew String(L"String1 %TEMP%"), VariableGetStringHelper(&variables, L"Variable8")); | 244 | Assert::Equal<String^>(gcnew String(L"String1 %TEMP%"), VariableGetStringHelper(&variables, L"Variable8")); |
238 | Assert::Equal(gcnew String(L"String1 %TEMP%"), VariableGetStringHelper(&variables, L"Variable9")); | 245 | Assert::Equal<String^>(gcnew String(L"String1 %TEMP%"), VariableGetStringHelper(&variables, L"Variable9")); |
239 | Assert::NotEqual(gcnew String(L"String1 %TEMP%"), VariableGetStringHelper(&variables, L"Variable10")); | 246 | Assert::NotEqual(gcnew String(L"String1 %TEMP%"), VariableGetStringHelper(&variables, L"Variable10")); |
240 | Assert::Equal(1ll, VariableGetNumericHelper(&variables, L"Variable11")); | 247 | Assert::Equal(1ll, VariableGetNumericHelper(&variables, L"Variable11")); |
241 | Assert::Equal(1ll, VariableGetNumericHelper(&variables, L"Variable12")); | 248 | Assert::Equal(1ll, VariableGetNumericHelper(&variables, L"Variable12")); |
242 | Assert::Equal(MAKEQWORDVERSION(1,1,1,1), VariableGetVersionHelper(&variables, L"Variable13")); | 249 | Assert::Equal(MAKEQWORDVERSION(1,1,1,1), VariableGetVersionHelper(&variables, L"Variable13")); |
243 | Assert::Equal(MAKEQWORDVERSION(1,1,1,1), VariableGetVersionHelper(&variables, L"Variable14")); | 250 | Assert::Equal(MAKEQWORDVERSION(1,1,1,1), VariableGetVersionHelper(&variables, L"Variable14")); |
244 | Assert::Equal(gcnew String(L"String1"), VariableGetStringHelper(&variables, L"Variable15")); | 251 | Assert::Equal<String^>(gcnew String(L"String1"), VariableGetStringHelper(&variables, L"Variable15")); |
245 | Assert::Equal(1ll, VariableGetNumericHelper(&variables, L"Variable16")); | 252 | Assert::Equal(1ll, VariableGetNumericHelper(&variables, L"Variable16")); |
246 | Assert::False(VariableExistsHelper(&variables, L"Variable17")); | 253 | Assert::False(VariableExistsHelper(&variables, L"Variable17")); |
247 | Assert::False(VariableExistsHelper(&variables, L"Variable18")); | 254 | Assert::False(VariableExistsHelper(&variables, L"Variable18")); |
248 | Assert::Equal(1ll, VariableGetNumericHelper(&variables, L"Variable19")); | 255 | Assert::Equal(1ll, VariableGetNumericHelper(&variables, L"Variable19")); |
249 | Assert::Equal(gcnew String(L"String1 %TEMP%"), VariableGetStringHelper(&variables, L"Variable20")); | 256 | Assert::Equal<String^>(gcnew String(L"String1 %TEMP%"), VariableGetStringHelper(&variables, L"Variable20")); |
250 | if (f64bitMachine) | 257 | if (f64bitMachine) |
251 | { | 258 | { |
252 | Assert::Equal(gcnew String(L"32-bit"), VariableGetStringHelper(&variables, L"Variable21")); | 259 | Assert::Equal<String^>(gcnew String(L"32-bit"), VariableGetStringHelper(&variables, L"Variable21")); |
253 | Assert::Equal(gcnew String(L"64-bit"), VariableGetStringHelper(&variables, L"Variable22")); | 260 | Assert::Equal<String^>(gcnew String(L"64-bit"), VariableGetStringHelper(&variables, L"Variable22")); |
254 | } | 261 | } |
255 | 262 | ||
256 | Assert::Equal(1ll, VariableGetNumericHelper(&variables, L"Variable23")); | 263 | Assert::Equal(1ll, VariableGetNumericHelper(&variables, L"Variable23")); |
257 | Assert::Equal(0ll, VariableGetNumericHelper(&variables, L"Variable24")); | 264 | Assert::Equal(0ll, VariableGetNumericHelper(&variables, L"Variable24")); |
258 | Assert::Equal(gcnew String(L"Msi.Package"), VariableGetStringHelper(&variables, L"Variable25")); | 265 | Assert::Equal<String^>(gcnew String(L"Msi.Package"), VariableGetStringHelper(&variables, L"Variable25")); |
259 | } | 266 | } |
260 | finally | 267 | finally |
261 | { | 268 | { |
@@ -276,13 +283,14 @@ namespace Bootstrapper | |||
276 | } | 283 | } |
277 | } | 284 | } |
278 | 285 | ||
279 | [NamedFact] | 286 | [Fact] |
280 | void MsiComponentSearchTest() | 287 | void MsiComponentSearchTest() |
281 | { | 288 | { |
282 | HRESULT hr = S_OK; | 289 | HRESULT hr = S_OK; |
283 | IXMLDOMElement* pixeBundle = NULL; | 290 | IXMLDOMElement* pixeBundle = NULL; |
284 | BURN_VARIABLES variables = { }; | 291 | BURN_VARIABLES variables = { }; |
285 | BURN_SEARCHES searches = { }; | 292 | BURN_SEARCHES searches = { }; |
293 | BURN_EXTENSIONS burnExtensions = { }; | ||
286 | try | 294 | try |
287 | { | 295 | { |
288 | hr = VariableInitialize(&variables); | 296 | hr = VariableInitialize(&variables); |
@@ -317,7 +325,7 @@ namespace Bootstrapper | |||
317 | // load XML document | 325 | // load XML document |
318 | LoadBundleXmlHelper(wzDocument, &pixeBundle); | 326 | LoadBundleXmlHelper(wzDocument, &pixeBundle); |
319 | 327 | ||
320 | hr = SearchesParseFromXml(&searches, pixeBundle); | 328 | hr = SearchesParseFromXml(&searches, &burnExtensions, pixeBundle); |
321 | TestThrowOnFailure(hr, L"Failed to parse searches from XML."); | 329 | TestThrowOnFailure(hr, L"Failed to parse searches from XML."); |
322 | 330 | ||
323 | // execute searches | 331 | // execute searches |
@@ -328,22 +336,22 @@ namespace Bootstrapper | |||
328 | Assert::Equal(2ll, VariableGetNumericHelper(&variables, L"Variable1")); | 336 | Assert::Equal(2ll, VariableGetNumericHelper(&variables, L"Variable1")); |
329 | Assert::Equal(2ll, VariableGetNumericHelper(&variables, L"Variable2")); | 337 | Assert::Equal(2ll, VariableGetNumericHelper(&variables, L"Variable2")); |
330 | Assert::Equal(2ll, VariableGetNumericHelper(&variables, L"Variable3")); | 338 | Assert::Equal(2ll, VariableGetNumericHelper(&variables, L"Variable3")); |
331 | Assert::Equal(gcnew String(L"C:\\directory\\file1.txt"), VariableGetStringHelper(&variables, L"Variable4")); | 339 | Assert::Equal<String^>(gcnew String(L"C:\\directory\\file1.txt"), VariableGetStringHelper(&variables, L"Variable4")); |
332 | Assert::Equal(gcnew String(L"C:\\directory\\file2.txt"), VariableGetStringHelper(&variables, L"Variable5")); | 340 | Assert::Equal<String^>(gcnew String(L"C:\\directory\\file2.txt"), VariableGetStringHelper(&variables, L"Variable5")); |
333 | Assert::Equal(gcnew String(L"C:\\directory\\file3.txt"), VariableGetStringHelper(&variables, L"Variable6")); | 341 | Assert::Equal<String^>(gcnew String(L"C:\\directory\\file3.txt"), VariableGetStringHelper(&variables, L"Variable6")); |
334 | Assert::Equal(gcnew String(L"C:\\directory\\file4.txt"), VariableGetStringHelper(&variables, L"Variable7")); | 342 | Assert::Equal<String^>(gcnew String(L"C:\\directory\\file4.txt"), VariableGetStringHelper(&variables, L"Variable7")); |
335 | Assert::Equal(gcnew String(L"02:\\SOFTWARE\\Microsoft\\WiX_Burn_UnitTest\\"), VariableGetStringHelper(&variables, L"Variable8")); | 343 | Assert::Equal<String^>(gcnew String(L"02:\\SOFTWARE\\Microsoft\\WiX_Burn_UnitTest\\"), VariableGetStringHelper(&variables, L"Variable8")); |
336 | Assert::Equal(gcnew String(L"02:\\SOFTWARE\\Microsoft\\WiX_Burn_UnitTest\\Value"), VariableGetStringHelper(&variables, L"Variable9")); | 344 | Assert::Equal<String^>(gcnew String(L"02:\\SOFTWARE\\Microsoft\\WiX_Burn_UnitTest\\Value"), VariableGetStringHelper(&variables, L"Variable9")); |
337 | Assert::Equal(3ll, VariableGetNumericHelper(&variables, L"Variable10")); | 345 | Assert::Equal(3ll, VariableGetNumericHelper(&variables, L"Variable10")); |
338 | Assert::Equal(3ll, VariableGetNumericHelper(&variables, L"Variable11")); | 346 | Assert::Equal(3ll, VariableGetNumericHelper(&variables, L"Variable11")); |
339 | Assert::Equal(4ll, VariableGetNumericHelper(&variables, L"Variable12")); | 347 | Assert::Equal(4ll, VariableGetNumericHelper(&variables, L"Variable12")); |
340 | Assert::Equal(4ll, VariableGetNumericHelper(&variables, L"Variable13")); | 348 | Assert::Equal(4ll, VariableGetNumericHelper(&variables, L"Variable13")); |
341 | Assert::Equal(2ll, VariableGetNumericHelper(&variables, L"Variable14")); | 349 | Assert::Equal(2ll, VariableGetNumericHelper(&variables, L"Variable14")); |
342 | Assert::Equal(gcnew String(L"C:\\directory\\"), VariableGetStringHelper(&variables, L"Variable15")); | 350 | Assert::Equal<String^>(gcnew String(L"C:\\directory\\"), VariableGetStringHelper(&variables, L"Variable15")); |
343 | Assert::Equal(gcnew String(L"C:\\directory\\"), VariableGetStringHelper(&variables, L"Variable16")); | 351 | Assert::Equal<String^>(gcnew String(L"C:\\directory\\"), VariableGetStringHelper(&variables, L"Variable16")); |
344 | Assert::Equal(gcnew String(L"C:\\directory\\"), VariableGetStringHelper(&variables, L"Variable17")); | 352 | Assert::Equal<String^>(gcnew String(L"C:\\directory\\"), VariableGetStringHelper(&variables, L"Variable17")); |
345 | Assert::Equal(gcnew String(L"C:\\directory\\"), VariableGetStringHelper(&variables, L"Variable18")); | 353 | Assert::Equal<String^>(gcnew String(L"C:\\directory\\"), VariableGetStringHelper(&variables, L"Variable18")); |
346 | Assert::Equal(gcnew String(L"C:\\directory\\directory\\directory\\directory\\directory\\directory\\directory\\directory\\directory\\directory\\directory\\directory\\directory\\directory\\directory\\directory\\directory\\directory\\directory\\directory\\directory\\directory\\directory\\directory\\directory\\directory\\file5.txt"), VariableGetStringHelper(&variables, L"Variable19")); | 354 | Assert::Equal<String^>(gcnew String(L"C:\\directory\\directory\\directory\\directory\\directory\\directory\\directory\\directory\\directory\\directory\\directory\\directory\\directory\\directory\\directory\\directory\\directory\\directory\\directory\\directory\\directory\\directory\\directory\\directory\\directory\\directory\\file5.txt"), VariableGetStringHelper(&variables, L"Variable19")); |
347 | } | 355 | } |
348 | finally | 356 | finally |
349 | { | 357 | { |
@@ -353,13 +361,14 @@ namespace Bootstrapper | |||
353 | } | 361 | } |
354 | } | 362 | } |
355 | 363 | ||
356 | [NamedFact] | 364 | [Fact] |
357 | void MsiProductSearchTest() | 365 | void MsiProductSearchTest() |
358 | { | 366 | { |
359 | HRESULT hr = S_OK; | 367 | HRESULT hr = S_OK; |
360 | IXMLDOMElement* pixeBundle = NULL; | 368 | IXMLDOMElement* pixeBundle = NULL; |
361 | BURN_VARIABLES variables = { }; | 369 | BURN_VARIABLES variables = { }; |
362 | BURN_SEARCHES searches = { }; | 370 | BURN_SEARCHES searches = { }; |
371 | BURN_EXTENSIONS burnExtensions = { }; | ||
363 | try | 372 | try |
364 | { | 373 | { |
365 | hr = VariableInitialize(&variables); | 374 | hr = VariableInitialize(&variables); |
@@ -381,7 +390,7 @@ namespace Bootstrapper | |||
381 | // load XML document | 390 | // load XML document |
382 | LoadBundleXmlHelper(wzDocument, &pixeBundle); | 391 | LoadBundleXmlHelper(wzDocument, &pixeBundle); |
383 | 392 | ||
384 | hr = SearchesParseFromXml(&searches, pixeBundle); | 393 | hr = SearchesParseFromXml(&searches, &burnExtensions, pixeBundle); |
385 | TestThrowOnFailure(hr, L"Failed to parse searches from XML."); | 394 | TestThrowOnFailure(hr, L"Failed to parse searches from XML."); |
386 | 395 | ||
387 | // execute searches | 396 | // execute searches |
@@ -404,13 +413,14 @@ namespace Bootstrapper | |||
404 | } | 413 | } |
405 | } | 414 | } |
406 | 415 | ||
407 | [NamedFact] | 416 | [Fact] |
408 | void MsiFeatureSearchTest() | 417 | void MsiFeatureSearchTest() |
409 | { | 418 | { |
410 | HRESULT hr = S_OK; | 419 | HRESULT hr = S_OK; |
411 | IXMLDOMElement* pixeBundle = NULL; | 420 | IXMLDOMElement* pixeBundle = NULL; |
412 | BURN_VARIABLES variables = { }; | 421 | BURN_VARIABLES variables = { }; |
413 | BURN_SEARCHES searches = { }; | 422 | BURN_SEARCHES searches = { }; |
423 | BURN_EXTENSIONS burnExtensions = { }; | ||
414 | try | 424 | try |
415 | { | 425 | { |
416 | LPCWSTR wzDocument = | 426 | LPCWSTR wzDocument = |
@@ -424,7 +434,7 @@ namespace Bootstrapper | |||
424 | // load XML document | 434 | // load XML document |
425 | LoadBundleXmlHelper(wzDocument, &pixeBundle); | 435 | LoadBundleXmlHelper(wzDocument, &pixeBundle); |
426 | 436 | ||
427 | hr = SearchesParseFromXml(&searches, pixeBundle); | 437 | hr = SearchesParseFromXml(&searches, &burnExtensions, pixeBundle); |
428 | TestThrowOnFailure(hr, L"Failed to parse searches from XML."); | 438 | TestThrowOnFailure(hr, L"Failed to parse searches from XML."); |
429 | 439 | ||
430 | // execute searches | 440 | // execute searches |
@@ -439,13 +449,14 @@ namespace Bootstrapper | |||
439 | } | 449 | } |
440 | } | 450 | } |
441 | 451 | ||
442 | [NamedFact] | 452 | [Fact] |
443 | void ConditionalSearchTest() | 453 | void ConditionalSearchTest() |
444 | { | 454 | { |
445 | HRESULT hr = S_OK; | 455 | HRESULT hr = S_OK; |
446 | IXMLDOMElement* pixeBundle = NULL; | 456 | IXMLDOMElement* pixeBundle = NULL; |
447 | BURN_VARIABLES variables = { }; | 457 | BURN_VARIABLES variables = { }; |
448 | BURN_SEARCHES searches = { }; | 458 | BURN_SEARCHES searches = { }; |
459 | BURN_EXTENSIONS burnExtensions = { }; | ||
449 | try | 460 | try |
450 | { | 461 | { |
451 | LPCWSTR wzDocument = | 462 | LPCWSTR wzDocument = |
@@ -461,7 +472,7 @@ namespace Bootstrapper | |||
461 | // load XML document | 472 | // load XML document |
462 | LoadBundleXmlHelper(wzDocument, &pixeBundle); | 473 | LoadBundleXmlHelper(wzDocument, &pixeBundle); |
463 | 474 | ||
464 | hr = SearchesParseFromXml(&searches, pixeBundle); | 475 | hr = SearchesParseFromXml(&searches, &burnExtensions, pixeBundle); |
465 | TestThrowOnFailure(hr, L"Failed to parse searches from XML."); | 476 | TestThrowOnFailure(hr, L"Failed to parse searches from XML."); |
466 | 477 | ||
467 | // execute searches | 478 | // execute searches |
@@ -480,13 +491,14 @@ namespace Bootstrapper | |||
480 | SearchesUninitialize(&searches); | 491 | SearchesUninitialize(&searches); |
481 | } | 492 | } |
482 | } | 493 | } |
483 | [NamedFact] | 494 | [Fact] |
484 | void NoSearchesTest() | 495 | void NoSearchesTest() |
485 | { | 496 | { |
486 | HRESULT hr = S_OK; | 497 | HRESULT hr = S_OK; |
487 | IXMLDOMElement* pixeBundle = NULL; | 498 | IXMLDOMElement* pixeBundle = NULL; |
488 | BURN_VARIABLES variables = { }; | 499 | BURN_VARIABLES variables = { }; |
489 | BURN_SEARCHES searches = { }; | 500 | BURN_SEARCHES searches = { }; |
501 | BURN_EXTENSIONS burnExtensions = { }; | ||
490 | try | 502 | try |
491 | { | 503 | { |
492 | LPCWSTR wzDocument = | 504 | LPCWSTR wzDocument = |
@@ -499,7 +511,7 @@ namespace Bootstrapper | |||
499 | // load XML document | 511 | // load XML document |
500 | LoadBundleXmlHelper(wzDocument, &pixeBundle); | 512 | LoadBundleXmlHelper(wzDocument, &pixeBundle); |
501 | 513 | ||
502 | hr = SearchesParseFromXml(&searches, pixeBundle); | 514 | hr = SearchesParseFromXml(&searches, &burnExtensions, pixeBundle); |
503 | TestThrowOnFailure(hr, L"Failed to parse searches from XML."); | 515 | TestThrowOnFailure(hr, L"Failed to parse searches from XML."); |
504 | 516 | ||
505 | // execute searches | 517 | // execute searches |
diff --git a/src/test/BurnUnitTest/VariableTest.cpp b/src/test/BurnUnitTest/VariableTest.cpp index 3a4caecf..7d670744 100644 --- a/src/test/BurnUnitTest/VariableTest.cpp +++ b/src/test/BurnUnitTest/VariableTest.cpp | |||
@@ -20,7 +20,11 @@ namespace Bootstrapper | |||
20 | public ref class VariableTest : BurnUnitTest | 20 | public ref class VariableTest : BurnUnitTest |
21 | { | 21 | { |
22 | public: | 22 | public: |
23 | [NamedFact] | 23 | VariableTest(BurnTestFixture^ fixture) : BurnUnitTest(fixture) |
24 | { | ||
25 | } | ||
26 | |||
27 | [Fact] | ||
24 | void VariablesBasicTest() | 28 | void VariablesBasicTest() |
25 | { | 29 | { |
26 | HRESULT hr = S_OK; | 30 | HRESULT hr = S_OK; |
@@ -48,19 +52,19 @@ namespace Bootstrapper | |||
48 | VariableSetStringHelper(&variables, L"OVERWRITTEN_NUMBER", L"NEW"); | 52 | VariableSetStringHelper(&variables, L"OVERWRITTEN_NUMBER", L"NEW"); |
49 | 53 | ||
50 | // get and verify variable values | 54 | // get and verify variable values |
51 | Assert::Equal(gcnew String(L"VAL1"), VariableGetStringHelper(&variables, L"PROP1")); | 55 | Assert::Equal<String^>(gcnew String(L"VAL1"), VariableGetStringHelper(&variables, L"PROP1")); |
52 | Assert::Equal(2ll, VariableGetNumericHelper(&variables, L"PROP2")); | 56 | Assert::Equal(2ll, VariableGetNumericHelper(&variables, L"PROP2")); |
53 | Assert::Equal(gcnew String(L"2"), VariableGetStringHelper(&variables, L"PROP2")); | 57 | Assert::Equal<String^>(gcnew String(L"2"), VariableGetStringHelper(&variables, L"PROP2")); |
54 | Assert::Equal(gcnew String(L"VAL3"), VariableGetStringHelper(&variables, L"PROP3")); | 58 | Assert::Equal<String^>(gcnew String(L"VAL3"), VariableGetStringHelper(&variables, L"PROP3")); |
55 | Assert::Equal(gcnew String(L"VAL4"), VariableGetStringHelper(&variables, L"PROP4")); | 59 | Assert::Equal<String^>(gcnew String(L"VAL4"), VariableGetStringHelper(&variables, L"PROP4")); |
56 | Assert::Equal(gcnew String(L"VAL5"), VariableGetStringHelper(&variables, L"PROP5")); | 60 | Assert::Equal<String^>(gcnew String(L"VAL5"), VariableGetStringHelper(&variables, L"PROP5")); |
57 | Assert::Equal(gcnew String(L"VAL6"), VariableGetStringHelper(&variables, L"PROP6")); | 61 | Assert::Equal<String^>(gcnew String(L"VAL6"), VariableGetStringHelper(&variables, L"PROP6")); |
58 | Assert::Equal(7ll, VariableGetNumericHelper(&variables, L"PROP7")); | 62 | Assert::Equal(7ll, VariableGetNumericHelper(&variables, L"PROP7")); |
59 | Assert::Equal(MAKEQWORDVERSION(1,1,0,0), VariableGetVersionHelper(&variables, L"PROP8")); | 63 | Assert::Equal(MAKEQWORDVERSION(1,1,0,0), VariableGetVersionHelper(&variables, L"PROP8")); |
60 | Assert::Equal(gcnew String(L"1.1.0.0"), VariableGetStringHelper(&variables, L"PROP8")); | 64 | Assert::Equal<String^>(gcnew String(L"1.1.0.0"), VariableGetStringHelper(&variables, L"PROP8")); |
61 | 65 | ||
62 | Assert::Equal(42ll, VariableGetNumericHelper(&variables, L"OVERWRITTEN_STRING")); | 66 | Assert::Equal(42ll, VariableGetNumericHelper(&variables, L"OVERWRITTEN_STRING")); |
63 | Assert::Equal(gcnew String(L"NEW"), VariableGetStringHelper(&variables, L"OVERWRITTEN_NUMBER")); | 67 | Assert::Equal<String^>(gcnew String(L"NEW"), VariableGetStringHelper(&variables, L"OVERWRITTEN_NUMBER")); |
64 | } | 68 | } |
65 | finally | 69 | finally |
66 | { | 70 | { |
@@ -68,7 +72,7 @@ namespace Bootstrapper | |||
68 | } | 72 | } |
69 | } | 73 | } |
70 | 74 | ||
71 | [NamedFact] | 75 | [Fact] |
72 | void VariablesParseXmlTest() | 76 | void VariablesParseXmlTest() |
73 | { | 77 | { |
74 | HRESULT hr = S_OK; | 78 | HRESULT hr = S_OK; |
@@ -101,7 +105,7 @@ namespace Bootstrapper | |||
101 | Assert::Equal((int)BURN_VARIANT_TYPE_NONE, VariableGetTypeHelper(&variables, L"Var4")); | 105 | Assert::Equal((int)BURN_VARIANT_TYPE_NONE, VariableGetTypeHelper(&variables, L"Var4")); |
102 | 106 | ||
103 | Assert::Equal(1ll, VariableGetNumericHelper(&variables, L"Var1")); | 107 | Assert::Equal(1ll, VariableGetNumericHelper(&variables, L"Var1")); |
104 | Assert::Equal(gcnew String(L"String value."), VariableGetStringHelper(&variables, L"Var2")); | 108 | Assert::Equal<String^>(gcnew String(L"String value."), VariableGetStringHelper(&variables, L"Var2")); |
105 | Assert::Equal(MAKEQWORDVERSION(1,2,3,4), VariableGetVersionHelper(&variables, L"Var3")); | 109 | Assert::Equal(MAKEQWORDVERSION(1,2,3,4), VariableGetVersionHelper(&variables, L"Var3")); |
106 | } | 110 | } |
107 | finally | 111 | finally |
@@ -111,7 +115,7 @@ namespace Bootstrapper | |||
111 | } | 115 | } |
112 | } | 116 | } |
113 | 117 | ||
114 | [NamedFact] | 118 | [Fact] |
115 | void VariablesFormatTest() | 119 | void VariablesFormatTest() |
116 | { | 120 | { |
117 | HRESULT hr = S_OK; | 121 | HRESULT hr = S_OK; |
@@ -129,21 +133,21 @@ namespace Bootstrapper | |||
129 | VariableSetNumericHelper(&variables, L"PROP3", 3); | 133 | VariableSetNumericHelper(&variables, L"PROP3", 3); |
130 | 134 | ||
131 | // test string formatting | 135 | // test string formatting |
132 | Assert::Equal(gcnew String(L"NOPROP"), VariableFormatStringHelper(&variables, L"NOPROP")); | 136 | Assert::Equal<String^>(gcnew String(L"NOPROP"), VariableFormatStringHelper(&variables, L"NOPROP")); |
133 | Assert::Equal(gcnew String(L"VAL1"), VariableFormatStringHelper(&variables, L"[PROP1]")); | 137 | Assert::Equal<String^>(gcnew String(L"VAL1"), VariableFormatStringHelper(&variables, L"[PROP1]")); |
134 | Assert::Equal(gcnew String(L" VAL1 "), VariableFormatStringHelper(&variables, L" [PROP1] ")); | 138 | Assert::Equal<String^>(gcnew String(L" VAL1 "), VariableFormatStringHelper(&variables, L" [PROP1] ")); |
135 | Assert::Equal(gcnew String(L"PRE VAL1"), VariableFormatStringHelper(&variables, L"PRE [PROP1]")); | 139 | Assert::Equal<String^>(gcnew String(L"PRE VAL1"), VariableFormatStringHelper(&variables, L"PRE [PROP1]")); |
136 | Assert::Equal(gcnew String(L"VAL1 POST"), VariableFormatStringHelper(&variables, L"[PROP1] POST")); | 140 | Assert::Equal<String^>(gcnew String(L"VAL1 POST"), VariableFormatStringHelper(&variables, L"[PROP1] POST")); |
137 | Assert::Equal(gcnew String(L"PRE VAL1 POST"), VariableFormatStringHelper(&variables, L"PRE [PROP1] POST")); | 141 | Assert::Equal<String^>(gcnew String(L"PRE VAL1 POST"), VariableFormatStringHelper(&variables, L"PRE [PROP1] POST")); |
138 | Assert::Equal(gcnew String(L"VAL1 MID VAL2"), VariableFormatStringHelper(&variables, L"[PROP1] MID [PROP2]")); | 142 | Assert::Equal<String^>(gcnew String(L"VAL1 MID VAL2"), VariableFormatStringHelper(&variables, L"[PROP1] MID [PROP2]")); |
139 | Assert::Equal(gcnew String(L""), VariableFormatStringHelper(&variables, L"[NONE]")); | 143 | Assert::Equal<String^>(gcnew String(L""), VariableFormatStringHelper(&variables, L"[NONE]")); |
140 | Assert::Equal(gcnew String(L""), VariableFormatStringHelper(&variables, L"[prop1]")); | 144 | Assert::Equal<String^>(gcnew String(L""), VariableFormatStringHelper(&variables, L"[prop1]")); |
141 | Assert::Equal(gcnew String(L"["), VariableFormatStringHelper(&variables, L"[\\[]")); | 145 | Assert::Equal<String^>(gcnew String(L"["), VariableFormatStringHelper(&variables, L"[\\[]")); |
142 | Assert::Equal(gcnew String(L"]"), VariableFormatStringHelper(&variables, L"[\\]]")); | 146 | Assert::Equal<String^>(gcnew String(L"]"), VariableFormatStringHelper(&variables, L"[\\]]")); |
143 | Assert::Equal(gcnew String(L"[]"), VariableFormatStringHelper(&variables, L"[]")); | 147 | Assert::Equal<String^>(gcnew String(L"[]"), VariableFormatStringHelper(&variables, L"[]")); |
144 | Assert::Equal(gcnew String(L"[NONE"), VariableFormatStringHelper(&variables, L"[NONE")); | 148 | Assert::Equal<String^>(gcnew String(L"[NONE"), VariableFormatStringHelper(&variables, L"[NONE")); |
145 | Assert::Equal(gcnew String(L"VAL2"), VariableGetFormattedHelper(&variables, L"PROP2")); | 149 | Assert::Equal<String^>(gcnew String(L"VAL2"), VariableGetFormattedHelper(&variables, L"PROP2")); |
146 | Assert::Equal(gcnew String(L"3"), VariableGetFormattedHelper(&variables, L"PROP3")); | 150 | Assert::Equal<String^>(gcnew String(L"3"), VariableGetFormattedHelper(&variables, L"PROP3")); |
147 | 151 | ||
148 | hr = VariableFormatString(&variables, L"PRE [PROP1] POST", &scz, &cch); | 152 | hr = VariableFormatString(&variables, L"PRE [PROP1] POST", &scz, &cch); |
149 | TestThrowOnFailure(hr, L"Failed to format string"); | 153 | TestThrowOnFailure(hr, L"Failed to format string"); |
@@ -162,16 +166,16 @@ namespace Bootstrapper | |||
162 | } | 166 | } |
163 | } | 167 | } |
164 | 168 | ||
165 | [NamedFact] | 169 | [Fact] |
166 | void VariablesEscapeTest() | 170 | void VariablesEscapeTest() |
167 | { | 171 | { |
168 | // test string escaping | 172 | // test string escaping |
169 | Assert::Equal(gcnew String(L"[\\[]"), VariableEscapeStringHelper(L"[")); | 173 | Assert::Equal<String^>(gcnew String(L"[\\[]"), VariableEscapeStringHelper(L"[")); |
170 | Assert::Equal(gcnew String(L"[\\]]"), VariableEscapeStringHelper(L"]")); | 174 | Assert::Equal<String^>(gcnew String(L"[\\]]"), VariableEscapeStringHelper(L"]")); |
171 | Assert::Equal(gcnew String(L" [\\[]TEXT[\\]] "), VariableEscapeStringHelper(L" [TEXT] ")); | 175 | Assert::Equal<String^>(gcnew String(L" [\\[]TEXT[\\]] "), VariableEscapeStringHelper(L" [TEXT] ")); |
172 | } | 176 | } |
173 | 177 | ||
174 | [NamedFact] | 178 | [Fact] |
175 | void VariablesConditionTest() | 179 | void VariablesConditionTest() |
176 | { | 180 | { |
177 | HRESULT hr = S_OK; | 181 | HRESULT hr = S_OK; |
@@ -346,7 +350,7 @@ namespace Bootstrapper | |||
346 | } | 350 | } |
347 | } | 351 | } |
348 | 352 | ||
349 | [NamedFact] | 353 | [Fact] |
350 | void VariablesSerializationTest() | 354 | void VariablesSerializationTest() |
351 | { | 355 | { |
352 | HRESULT hr = S_OK; | 356 | HRESULT hr = S_OK; |
@@ -376,10 +380,10 @@ namespace Bootstrapper | |||
376 | hr = VariableDeserialize(&variables2, FALSE, pbBuffer, cbBuffer, &iBuffer); | 380 | hr = VariableDeserialize(&variables2, FALSE, pbBuffer, cbBuffer, &iBuffer); |
377 | TestThrowOnFailure(hr, L"Failed to deserialize variables."); | 381 | TestThrowOnFailure(hr, L"Failed to deserialize variables."); |
378 | 382 | ||
379 | Assert::Equal(gcnew String(L"VAL1"), VariableGetStringHelper(&variables2, L"PROP1")); | 383 | Assert::Equal<String^>(gcnew String(L"VAL1"), VariableGetStringHelper(&variables2, L"PROP1")); |
380 | Assert::Equal(2ll, VariableGetNumericHelper(&variables2, L"PROP2")); | 384 | Assert::Equal(2ll, VariableGetNumericHelper(&variables2, L"PROP2")); |
381 | Assert::Equal(MAKEQWORDVERSION(1,1,1,1), VariableGetVersionHelper(&variables2, L"PROP3")); | 385 | Assert::Equal(MAKEQWORDVERSION(1,1,1,1), VariableGetVersionHelper(&variables2, L"PROP3")); |
382 | Assert::Equal(gcnew String(L"VAL4"), VariableGetStringHelper(&variables2, L"PROP4")); | 386 | Assert::Equal<String^>(gcnew String(L"VAL4"), VariableGetStringHelper(&variables2, L"PROP4")); |
383 | } | 387 | } |
384 | finally | 388 | finally |
385 | { | 389 | { |
@@ -389,7 +393,7 @@ namespace Bootstrapper | |||
389 | } | 393 | } |
390 | } | 394 | } |
391 | 395 | ||
392 | [NamedFact] | 396 | [Fact] |
393 | void VariablesBuiltInTest() | 397 | void VariablesBuiltInTest() |
394 | { | 398 | { |
395 | HRESULT hr = S_OK; | 399 | HRESULT hr = S_OK; |
@@ -436,29 +440,29 @@ namespace Bootstrapper | |||
436 | VariableGetNumericHelper(&variables, L"UserLanguageID"); | 440 | VariableGetNumericHelper(&variables, L"UserLanguageID"); |
437 | 441 | ||
438 | // known folders | 442 | // known folders |
439 | Assert::Equal(Environment::GetFolderPath(Environment::SpecialFolder::ApplicationData) + "\\", VariableGetStringHelper(&variables, L"AppDataFolder")); | 443 | Assert::Equal<String^>(Environment::GetFolderPath(Environment::SpecialFolder::ApplicationData) + "\\", VariableGetStringHelper(&variables, L"AppDataFolder")); |
440 | Assert::Equal(Environment::GetFolderPath(Environment::SpecialFolder::CommonApplicationData) + "\\", VariableGetStringHelper(&variables, L"CommonAppDataFolder")); | 444 | Assert::Equal<String^>(Environment::GetFolderPath(Environment::SpecialFolder::CommonApplicationData) + "\\", VariableGetStringHelper(&variables, L"CommonAppDataFolder")); |
441 | 445 | ||
442 | Assert::Equal(Environment::GetFolderPath(Environment::SpecialFolder::ProgramFiles) + "\\", VariableGetStringHelper(&variables, L"ProgramFilesFolder")); | 446 | Assert::Equal<String^>(Environment::GetFolderPath(Environment::SpecialFolder::ProgramFiles) + "\\", VariableGetStringHelper(&variables, L"ProgramFilesFolder")); |
443 | Assert::Equal(Environment::GetFolderPath(Environment::SpecialFolder::DesktopDirectory) + "\\", VariableGetStringHelper(&variables, L"DesktopFolder")); | 447 | Assert::Equal<String^>(Environment::GetFolderPath(Environment::SpecialFolder::DesktopDirectory) + "\\", VariableGetStringHelper(&variables, L"DesktopFolder")); |
444 | Assert::Equal(Environment::GetFolderPath(Environment::SpecialFolder::Favorites) + "\\", VariableGetStringHelper(&variables, L"FavoritesFolder")); | 448 | Assert::Equal<String^>(Environment::GetFolderPath(Environment::SpecialFolder::Favorites) + "\\", VariableGetStringHelper(&variables, L"FavoritesFolder")); |
445 | VariableGetStringHelper(&variables, L"FontsFolder"); | 449 | VariableGetStringHelper(&variables, L"FontsFolder"); |
446 | Assert::Equal(Environment::GetFolderPath(Environment::SpecialFolder::LocalApplicationData) + "\\", VariableGetStringHelper(&variables, L"LocalAppDataFolder")); | 450 | Assert::Equal<String^>(Environment::GetFolderPath(Environment::SpecialFolder::LocalApplicationData) + "\\", VariableGetStringHelper(&variables, L"LocalAppDataFolder")); |
447 | Assert::Equal(Environment::GetFolderPath(Environment::SpecialFolder::Personal) + "\\", VariableGetStringHelper(&variables, L"PersonalFolder")); | 451 | Assert::Equal<String^>(Environment::GetFolderPath(Environment::SpecialFolder::Personal) + "\\", VariableGetStringHelper(&variables, L"PersonalFolder")); |
448 | Assert::Equal(Environment::GetFolderPath(Environment::SpecialFolder::Programs) + "\\", VariableGetStringHelper(&variables, L"ProgramMenuFolder")); | 452 | Assert::Equal<String^>(Environment::GetFolderPath(Environment::SpecialFolder::Programs) + "\\", VariableGetStringHelper(&variables, L"ProgramMenuFolder")); |
449 | Assert::Equal(Environment::GetFolderPath(Environment::SpecialFolder::SendTo) + "\\", VariableGetStringHelper(&variables, L"SendToFolder")); | 453 | Assert::Equal<String^>(Environment::GetFolderPath(Environment::SpecialFolder::SendTo) + "\\", VariableGetStringHelper(&variables, L"SendToFolder")); |
450 | Assert::Equal(Environment::GetFolderPath(Environment::SpecialFolder::StartMenu) + "\\", VariableGetStringHelper(&variables, L"StartMenuFolder")); | 454 | Assert::Equal<String^>(Environment::GetFolderPath(Environment::SpecialFolder::StartMenu) + "\\", VariableGetStringHelper(&variables, L"StartMenuFolder")); |
451 | Assert::Equal(Environment::GetFolderPath(Environment::SpecialFolder::Startup) + "\\", VariableGetStringHelper(&variables, L"StartupFolder")); | 455 | Assert::Equal<String^>(Environment::GetFolderPath(Environment::SpecialFolder::Startup) + "\\", VariableGetStringHelper(&variables, L"StartupFolder")); |
452 | VariableGetStringHelper(&variables, L"SystemFolder"); | 456 | VariableGetStringHelper(&variables, L"SystemFolder"); |
453 | VariableGetStringHelper(&variables, L"WindowsFolder"); | 457 | VariableGetStringHelper(&variables, L"WindowsFolder"); |
454 | VariableGetStringHelper(&variables, L"WindowsVolume"); | 458 | VariableGetStringHelper(&variables, L"WindowsVolume"); |
455 | 459 | ||
456 | Assert::Equal(System::IO::Path::GetTempPath(), System::IO::Path::GetFullPath(VariableGetStringHelper(&variables, L"TempFolder"))); | 460 | Assert::Equal<String^>(System::IO::Path::GetTempPath(), System::IO::Path::GetFullPath(VariableGetStringHelper(&variables, L"TempFolder"))); |
457 | 461 | ||
458 | VariableGetStringHelper(&variables, L"AdminToolsFolder"); | 462 | VariableGetStringHelper(&variables, L"AdminToolsFolder"); |
459 | Assert::Equal(Environment::GetFolderPath(Environment::SpecialFolder::CommonProgramFiles) + "\\", VariableGetStringHelper(&variables, L"CommonFilesFolder")); | 463 | Assert::Equal<String^>(Environment::GetFolderPath(Environment::SpecialFolder::CommonProgramFiles) + "\\", VariableGetStringHelper(&variables, L"CommonFilesFolder")); |
460 | Assert::Equal(Environment::GetFolderPath(Environment::SpecialFolder::MyPictures) + "\\", VariableGetStringHelper(&variables, L"MyPicturesFolder")); | 464 | Assert::Equal<String^>(Environment::GetFolderPath(Environment::SpecialFolder::MyPictures) + "\\", VariableGetStringHelper(&variables, L"MyPicturesFolder")); |
461 | Assert::Equal(Environment::GetFolderPath(Environment::SpecialFolder::Templates) + "\\", VariableGetStringHelper(&variables, L"TemplateFolder")); | 465 | Assert::Equal<String^>(Environment::GetFolderPath(Environment::SpecialFolder::Templates) + "\\", VariableGetStringHelper(&variables, L"TemplateFolder")); |
462 | 466 | ||
463 | if (Environment::Is64BitOperatingSystem) | 467 | if (Environment::Is64BitOperatingSystem) |
464 | { | 468 | { |
diff --git a/src/test/BurnUnitTest/packages.config b/src/test/BurnUnitTest/packages.config new file mode 100644 index 00000000..27527ed6 --- /dev/null +++ b/src/test/BurnUnitTest/packages.config | |||
@@ -0,0 +1,14 @@ | |||
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. --> | ||
3 | <packages> | ||
4 | <package id="xunit.abstractions" version="2.0.3" /> | ||
5 | <package id="xunit.assert" version="2.4.1" /> | ||
6 | <package id="xunit.core" version="2.4.1" /> | ||
7 | <package id="xunit.extensibility.core" version="2.4.1" /> | ||
8 | <package id="xunit.extensibility.execution" version="2.4.1" /> | ||
9 | <package id="xunit.runner.visualstudio" version="2.4.1" /> | ||
10 | <package id="WixBuildTools.TestSupport" version="4.0.40" /> | ||
11 | <package id="WixBuildTools.TestSupport.Native" version="4.0.40" /> | ||
12 | <package id="WixToolset.BootstrapperCore.Native" version="4.0.16" targetFramework="native" /> | ||
13 | <package id="WixToolset.DUtil" version="4.0.45" targetFramework="native" /> | ||
14 | </packages> \ No newline at end of file | ||
diff --git a/src/test/BurnUnitTest/precomp.h b/src/test/BurnUnitTest/precomp.h index 1f2ccb8b..e288eb3e 100644 --- a/src/test/BurnUnitTest/precomp.h +++ b/src/test/BurnUnitTest/precomp.h | |||
@@ -30,22 +30,23 @@ | |||
30 | #include <dictutil.h> | 30 | #include <dictutil.h> |
31 | #include <deputil.h> | 31 | #include <deputil.h> |
32 | 32 | ||
33 | #include <wixver.h> | ||
34 | |||
35 | #include "BootstrapperEngine.h" | 33 | #include "BootstrapperEngine.h" |
36 | #include "BootstrapperApplication.h" | 34 | #include "BootstrapperApplication.h" |
35 | #include "BundleExtensionEngine.h" | ||
36 | #include "BundleExtension.h" | ||
37 | 37 | ||
38 | #include "platform.h" | 38 | #include "platform.h" |
39 | #include "variant.h" | 39 | #include "variant.h" |
40 | #include "variable.h" | 40 | #include "variable.h" |
41 | #include "condition.h" | 41 | #include "condition.h" |
42 | #include "search.h" | ||
43 | #include "section.h" | 42 | #include "section.h" |
44 | #include "approvedexe.h" | 43 | #include "approvedexe.h" |
45 | #include "container.h" | 44 | #include "container.h" |
46 | #include "catalog.h" | 45 | #include "catalog.h" |
47 | #include "payload.h" | 46 | #include "payload.h" |
48 | #include "cabextract.h" | 47 | #include "cabextract.h" |
48 | #include "burnextension.h" | ||
49 | #include "search.h" | ||
49 | #include "userexperience.h" | 50 | #include "userexperience.h" |
50 | #include "package.h" | 51 | #include "package.h" |
51 | #include "update.h" | 52 | #include "update.h" |