diff options
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 | } | ||