From 7f642e51670bc38a4ef782a363936850bc2b0ba9 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Thu, 22 Apr 2021 06:38:23 -0700 Subject: Move dutil into libs/dutil --- .../dutil/test/DUtilUnitTest/ApupUtilTests.cpp | 46 ++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/libs/dutil/test/DUtilUnitTest/ApupUtilTests.cpp (limited to 'src/libs/dutil/test/DUtilUnitTest/ApupUtilTests.cpp') diff --git a/src/libs/dutil/test/DUtilUnitTest/ApupUtilTests.cpp b/src/libs/dutil/test/DUtilUnitTest/ApupUtilTests.cpp new file mode 100644 index 00000000..30a45f5a --- /dev/null +++ b/src/libs/dutil/test/DUtilUnitTest/ApupUtilTests.cpp @@ -0,0 +1,46 @@ +// 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. + +#include "precomp.h" + +using namespace System; +using namespace Xunit; +using namespace WixBuildTools::TestSupport; + +namespace DutilTests +{ + public ref class ApupUtil + { + public: + [Fact] + void AllocChainFromAtomSortsDescending() + { + HRESULT hr = S_OK; + ATOM_FEED* pFeed = NULL; + APPLICATION_UPDATE_CHAIN* pChain = NULL; + + DutilInitialize(&DutilTestTraceError); + + try + { + XmlInitialize(); + NativeAssert::Succeeded(hr, "Failed to initialize Xml."); + + pin_ptr feedFilePath = PtrToStringChars(TestData::Get("TestData", "ApupUtilTests", "FeedBv2.0.xml")); + hr = AtomParseFromFile(feedFilePath, &pFeed); + NativeAssert::Succeeded(hr, "Failed to parse feed: {0}", feedFilePath); + + hr = ApupAllocChainFromAtom(pFeed, &pChain); + NativeAssert::Succeeded(hr, "Failed to get chain from feed."); + + Assert::Equal(3ul, pChain->cEntries); + NativeAssert::StringEqual(L"Bundle v2.0", pChain->rgEntries[0].wzTitle); + NativeAssert::StringEqual(L"Bundle v1.0", pChain->rgEntries[1].wzTitle); + NativeAssert::StringEqual(L"Bundle v1.0-preview", pChain->rgEntries[2].wzTitle); + } + finally + { + DutilUninitialize(); + } + } + }; +} -- cgit v1.2.3-55-g6feb