diff options
| author | Sean Hall <r.sean.hall@gmail.com> | 2020-07-15 21:41:47 +1000 |
|---|---|---|
| committer | Sean Hall <r.sean.hall@gmail.com> | 2020-07-16 16:49:44 +1000 |
| commit | 8bcb8c013a258691d4004c50af4689b90dd05c45 (patch) | |
| tree | c79af1f50a94bb8554672a7de231ab35f5e5ddf1 /src/test/BurnUnitTest/ManifestTest.cpp | |
| parent | a49441dfa8f9f796d98ce240ffb839b325908498 (diff) | |
| download | wix-8bcb8c013a258691d4004c50af4689b90dd05c45.tar.gz wix-8bcb8c013a258691d4004c50af4689b90dd05c45.tar.bz2 wix-8bcb8c013a258691d4004c50af4689b90dd05c45.zip | |
Import BurnUnitTest from old wix4 repo.
Diffstat (limited to 'src/test/BurnUnitTest/ManifestTest.cpp')
| -rw-r--r-- | src/test/BurnUnitTest/ManifestTest.cpp | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/src/test/BurnUnitTest/ManifestTest.cpp b/src/test/BurnUnitTest/ManifestTest.cpp new file mode 100644 index 00000000..14ead82e --- /dev/null +++ b/src/test/BurnUnitTest/ManifestTest.cpp | |||
| @@ -0,0 +1,59 @@ | |||
| 1 | // 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 | |||
| 3 | #include "precomp.h" | ||
| 4 | |||
| 5 | namespace Microsoft | ||
| 6 | { | ||
| 7 | namespace Tools | ||
| 8 | { | ||
| 9 | namespace WindowsInstallerXml | ||
| 10 | { | ||
| 11 | namespace Test | ||
| 12 | { | ||
| 13 | namespace Bootstrapper | ||
| 14 | { | ||
| 15 | using namespace System; | ||
| 16 | using namespace WixTest; | ||
| 17 | using namespace Xunit; | ||
| 18 | |||
| 19 | public ref class ManifestTest : BurnUnitTest | ||
| 20 | { | ||
| 21 | public: | ||
| 22 | [NamedFact] | ||
| 23 | void ManifestLoadXmlTest() | ||
| 24 | { | ||
| 25 | HRESULT hr = S_OK; | ||
| 26 | BURN_ENGINE_STATE engineState = { }; | ||
| 27 | try | ||
| 28 | { | ||
| 29 | LPCSTR szDocument = | ||
| 30 | "<Bundle>" | ||
| 31 | " <UX UxDllPayloadId='ux.dll'>" | ||
| 32 | " <Payload Id='ux.dll' FilePath='ux.dll' Packaging='embedded' SourcePath='ux.dll' Hash='000000000000' />" | ||
| 33 | " </UX>" | ||
| 34 | " <Registration Id='{D54F896D-1952-43e6-9C67-B5652240618C}' Tag='foo' ProviderKey='foo' Version='1.0.0.0' ExecutableName='setup.exe' PerMachine='no' />" | ||
| 35 | " <Variable Id='Variable1' Type='numeric' Value='1' Hidden='no' Persisted='no' />" | ||
| 36 | " <RegistrySearch Id='Search1' Type='exists' Root='HKLM' Key='SOFTWARE\\Microsoft' Variable='Variable1' Condition='0' />" | ||
| 37 | "</Bundle>"; | ||
| 38 | |||
| 39 | hr = VariableInitialize(&engineState.variables); | ||
| 40 | TestThrowOnFailure(hr, L"Failed to initialize variables."); | ||
| 41 | |||
| 42 | // load manifest from XML | ||
| 43 | hr = ManifestLoadXmlFromBuffer((BYTE*)szDocument, lstrlenA(szDocument), &engineState); | ||
| 44 | TestThrowOnFailure(hr, L"Failed to parse searches from XML."); | ||
| 45 | |||
| 46 | // check variable values | ||
| 47 | Assert::True(VariableExistsHelper(&engineState.variables, L"Variable1")); | ||
| 48 | } | ||
| 49 | finally | ||
| 50 | { | ||
| 51 | //CoreUninitialize(&engineState); | ||
| 52 | } | ||
| 53 | } | ||
| 54 | }; | ||
| 55 | } | ||
| 56 | } | ||
| 57 | } | ||
| 58 | } | ||
| 59 | } | ||
