diff options
| author | Sean Hall <r.sean.hall@gmail.com> | 2021-03-30 17:15:25 -0500 |
|---|---|---|
| committer | Sean Hall <r.sean.hall@gmail.com> | 2021-03-30 17:19:19 -0500 |
| commit | ed0ef472c76ac0d2a3d7a138e4f3b7ad950a56bc (patch) | |
| tree | 0b409592d759b43f583b44d2d854d8c44199bcee /src/test/DUtilUnitTest/ApupUtilTests.cpp | |
| parent | 10ebf674da5df9224e4eddd3545518434c5b455b (diff) | |
| download | wix-ed0ef472c76ac0d2a3d7a138e4f3b7ad950a56bc.tar.gz wix-ed0ef472c76ac0d2a3d7a138e4f3b7ad950a56bc.tar.bz2 wix-ed0ef472c76ac0d2a3d7a138e4f3b7ad950a56bc.zip | |
Add test for apuputil and fix descending sorting.
Diffstat (limited to 'src/test/DUtilUnitTest/ApupUtilTests.cpp')
| -rw-r--r-- | src/test/DUtilUnitTest/ApupUtilTests.cpp | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/test/DUtilUnitTest/ApupUtilTests.cpp b/src/test/DUtilUnitTest/ApupUtilTests.cpp new file mode 100644 index 00000000..30a45f5a --- /dev/null +++ b/src/test/DUtilUnitTest/ApupUtilTests.cpp | |||
| @@ -0,0 +1,46 @@ | |||
| 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 | using namespace System; | ||
| 6 | using namespace Xunit; | ||
| 7 | using namespace WixBuildTools::TestSupport; | ||
| 8 | |||
| 9 | namespace DutilTests | ||
| 10 | { | ||
| 11 | public ref class ApupUtil | ||
| 12 | { | ||
| 13 | public: | ||
| 14 | [Fact] | ||
| 15 | void AllocChainFromAtomSortsDescending() | ||
| 16 | { | ||
| 17 | HRESULT hr = S_OK; | ||
| 18 | ATOM_FEED* pFeed = NULL; | ||
| 19 | APPLICATION_UPDATE_CHAIN* pChain = NULL; | ||
| 20 | |||
| 21 | DutilInitialize(&DutilTestTraceError); | ||
| 22 | |||
| 23 | try | ||
| 24 | { | ||
| 25 | XmlInitialize(); | ||
| 26 | NativeAssert::Succeeded(hr, "Failed to initialize Xml."); | ||
| 27 | |||
| 28 | pin_ptr<const wchar_t> feedFilePath = PtrToStringChars(TestData::Get("TestData", "ApupUtilTests", "FeedBv2.0.xml")); | ||
| 29 | hr = AtomParseFromFile(feedFilePath, &pFeed); | ||
| 30 | NativeAssert::Succeeded(hr, "Failed to parse feed: {0}", feedFilePath); | ||
| 31 | |||
| 32 | hr = ApupAllocChainFromAtom(pFeed, &pChain); | ||
| 33 | NativeAssert::Succeeded(hr, "Failed to get chain from feed."); | ||
| 34 | |||
| 35 | Assert::Equal(3ul, pChain->cEntries); | ||
| 36 | NativeAssert::StringEqual(L"Bundle v2.0", pChain->rgEntries[0].wzTitle); | ||
| 37 | NativeAssert::StringEqual(L"Bundle v1.0", pChain->rgEntries[1].wzTitle); | ||
| 38 | NativeAssert::StringEqual(L"Bundle v1.0-preview", pChain->rgEntries[2].wzTitle); | ||
| 39 | } | ||
| 40 | finally | ||
| 41 | { | ||
| 42 | DutilUninitialize(); | ||
| 43 | } | ||
| 44 | } | ||
| 45 | }; | ||
| 46 | } | ||
