diff options
Diffstat (limited to 'src/burn/test/BurnUnitTest/ManifestTest.cpp')
| -rw-r--r-- | src/burn/test/BurnUnitTest/ManifestTest.cpp | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/src/burn/test/BurnUnitTest/ManifestTest.cpp b/src/burn/test/BurnUnitTest/ManifestTest.cpp new file mode 100644 index 00000000..963be156 --- /dev/null +++ b/src/burn/test/BurnUnitTest/ManifestTest.cpp | |||
| @@ -0,0 +1,62 @@ | |||
| 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 Xunit; | ||
| 17 | |||
| 18 | public ref class ManifestTest : BurnUnitTest | ||
| 19 | { | ||
| 20 | public: | ||
| 21 | ManifestTest(BurnTestFixture^ fixture) : BurnUnitTest(fixture) | ||
| 22 | { | ||
| 23 | } | ||
| 24 | |||
| 25 | [Fact] | ||
| 26 | void ManifestLoadXmlTest() | ||
| 27 | { | ||
| 28 | HRESULT hr = S_OK; | ||
| 29 | BURN_ENGINE_STATE engineState = { }; | ||
| 30 | try | ||
| 31 | { | ||
| 32 | LPCSTR szDocument = | ||
| 33 | "<Bundle>" | ||
| 34 | " <UX UxDllPayloadId='ux.dll'>" | ||
| 35 | " <Payload Id='ux.dll' FilePath='ux.dll' Packaging='embedded' SourcePath='ux.dll' Hash='000000000000' />" | ||
| 36 | " </UX>" | ||
| 37 | " <Registration Id='{D54F896D-1952-43e6-9C67-B5652240618C}' Tag='foo' ProviderKey='foo' Version='1.0.0.0' ExecutableName='setup.exe' PerMachine='no' />" | ||
| 38 | " <Variable Id='Variable1' Type='numeric' Value='1' Hidden='no' Persisted='no' />" | ||
| 39 | " <RegistrySearch Id='Search1' Type='exists' Root='HKLM' Key='SOFTWARE\\Microsoft' Variable='Variable1' Condition='0' />" | ||
| 40 | "</Bundle>"; | ||
| 41 | |||
| 42 | hr = VariableInitialize(&engineState.variables); | ||
| 43 | TestThrowOnFailure(hr, L"Failed to initialize variables."); | ||
| 44 | |||
| 45 | // load manifest from XML | ||
| 46 | hr = ManifestLoadXmlFromBuffer((BYTE*)szDocument, lstrlenA(szDocument), &engineState); | ||
| 47 | TestThrowOnFailure(hr, L"Failed to parse searches from XML."); | ||
| 48 | |||
| 49 | // check variable values | ||
| 50 | Assert::True(VariableExistsHelper(&engineState.variables, L"Variable1")); | ||
| 51 | } | ||
| 52 | finally | ||
| 53 | { | ||
| 54 | //CoreUninitialize(&engineState); | ||
| 55 | } | ||
| 56 | } | ||
| 57 | }; | ||
| 58 | } | ||
| 59 | } | ||
| 60 | } | ||
| 61 | } | ||
| 62 | } | ||
