aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/DUtilUnitTest/ApupUtilTests.cpp46
-rw-r--r--src/test/DUtilUnitTest/DUtilUnitTest.vcxproj4
-rw-r--r--src/test/DUtilUnitTest/DUtilUnitTest.vcxproj.filters3
-rw-r--r--src/test/DUtilUnitTest/TestData/ApupUtilTests/FeedBv2.0.xml68
-rw-r--r--src/test/DUtilUnitTest/precomp.h6
5 files changed, 126 insertions, 1 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
5using namespace System;
6using namespace Xunit;
7using namespace WixBuildTools::TestSupport;
8
9namespace 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}
diff --git a/src/test/DUtilUnitTest/DUtilUnitTest.vcxproj b/src/test/DUtilUnitTest/DUtilUnitTest.vcxproj
index 942c39f0..32463262 100644
--- a/src/test/DUtilUnitTest/DUtilUnitTest.vcxproj
+++ b/src/test/DUtilUnitTest/DUtilUnitTest.vcxproj
@@ -30,6 +30,7 @@
30 <ProjectAdditionalLinkLibraries>rpcrt4.lib;Mpr.lib;Ws2_32.lib;urlmon.lib;wininet.lib</ProjectAdditionalLinkLibraries> 30 <ProjectAdditionalLinkLibraries>rpcrt4.lib;Mpr.lib;Ws2_32.lib;urlmon.lib;wininet.lib</ProjectAdditionalLinkLibraries>
31 </PropertyGroup> 31 </PropertyGroup>
32 <ItemGroup> 32 <ItemGroup>
33 <ClCompile Include="ApupUtilTests.cpp" />
33 <ClCompile Include="AssemblyInfo.cpp" /> 34 <ClCompile Include="AssemblyInfo.cpp" />
34 <ClCompile Include="DictUtilTest.cpp" /> 35 <ClCompile Include="DictUtilTest.cpp" />
35 <ClCompile Include="DirUtilTests.cpp" /> 36 <ClCompile Include="DirUtilTests.cpp" />
@@ -60,6 +61,9 @@
60 <ResourceCompile Include="UnitTest.rc" /> 61 <ResourceCompile Include="UnitTest.rc" />
61 </ItemGroup> 62 </ItemGroup>
62 <ItemGroup> 63 <ItemGroup>
64 <None Include="TestData\ApupUtilTests\FeedBv2.0.xml" CopyToOutputDirectory="PreserveNewest" />
65 </ItemGroup>
66 <ItemGroup>
63 <Reference Include="System" /> 67 <Reference Include="System" />
64 <Reference Include="System.Core" /> 68 <Reference Include="System.Core" />
65 <Reference Include="WixBuildTools.TestSupport"> 69 <Reference Include="WixBuildTools.TestSupport">
diff --git a/src/test/DUtilUnitTest/DUtilUnitTest.vcxproj.filters b/src/test/DUtilUnitTest/DUtilUnitTest.vcxproj.filters
index fdc6d278..4df7af89 100644
--- a/src/test/DUtilUnitTest/DUtilUnitTest.vcxproj.filters
+++ b/src/test/DUtilUnitTest/DUtilUnitTest.vcxproj.filters
@@ -15,6 +15,9 @@
15 </Filter> 15 </Filter>
16 </ItemGroup> 16 </ItemGroup>
17 <ItemGroup> 17 <ItemGroup>
18 <ClCompile Include="ApupUtilTests.cpp">
19 <Filter>Source Files</Filter>
20 </ClCompile>
18 <ClCompile Include="AssemblyInfo.cpp"> 21 <ClCompile Include="AssemblyInfo.cpp">
19 <Filter>Source Files</Filter> 22 <Filter>Source Files</Filter>
20 </ClCompile> 23 </ClCompile>
diff --git a/src/test/DUtilUnitTest/TestData/ApupUtilTests/FeedBv2.0.xml b/src/test/DUtilUnitTest/TestData/ApupUtilTests/FeedBv2.0.xml
new file mode 100644
index 00000000..d9f961fe
--- /dev/null
+++ b/src/test/DUtilUnitTest/TestData/ApupUtilTests/FeedBv2.0.xml
@@ -0,0 +1,68 @@
1<?xml version='1.0' ?>
2<!-- 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. -->
3
4
5<feed xmlns="http://www.w3.org/2005/Atom" xmlns:as="http://appsyndication.org/2006/appsyn">
6 <title type="text">BundleB v2.0</title>
7 <subtitle type="text">Bundle Subtitle.</subtitle>
8 <as:application type="application/exe">1116353B-7C6E-4C29-BFA1-D4A972CD421D</as:application>
9 <updated>2014-07-14T12:39:00.000Z</updated>
10 <id>http://localhost:9999/wix4/BundleB/feed</id>
11 <link rel="self" type="application/atom+xml" href="http://localhost:9999/wix4/BundleB/feed"/>
12 <generator version="0.1">manual build</generator>
13 <entry>
14 <title>Bundle v2.0</title>
15 <id>v2.0</id>
16 <author>
17 <name>Bundle_Author</name>
18 <uri>http://mycompany.com/software</uri>
19 <email>Bundle_Author@mycompany.com</email>
20 </author>
21 <link rel="alternate" href="http://www.mycompany.com/content/view/software"/>
22 <link rel="enclosure" href="http://localhost:9999/wix4/BundleB/2.0/BundleB.exe" length="0" type="application/octet-stream"/>
23 <content type="html">
24 &lt;p&gt;Change list:&lt;/p&gt;&lt;ul&gt;
25 &lt;li&gt;Updated release.&lt;/li&gt;
26 &lt;/ul&gt;
27 </content>
28 <as:version>2.0.0.0</as:version>
29 <updated>2014-11-10T12:39:00.000Z</updated>
30 </entry>
31 <entry>
32 <title>Bundle v1.0</title>
33 <id>v1.0</id>
34 <author>
35 <name>Bundle_Author</name>
36 <uri>http://mycompany.com/software</uri>
37 <email>Bundle_Author@mycompany.com</email>
38 </author>
39 <link rel="alternate" href="http://www.mycompany.com/content/view/software"/>
40 <link rel="enclosure" href="http://localhost:9999/wix4/BundleB/1.0/BundleB.exe" length="0" type="application/octet-stream"/>
41 <content type="html">
42 &lt;p&gt;Change list:&lt;/p&gt;&lt;ul&gt;
43 &lt;li&gt;Initial release.&lt;/li&gt;
44 &lt;/ul&gt;
45 </content>
46 <as:upgrade version="1.0.0.0-preview" />
47 <as:version>1.0.0.0</as:version>
48 <updated>2014-11-09T12:39:00.000Z</updated>
49 </entry>
50 <entry>
51 <title>Bundle v1.0-preview</title>
52 <id>v1.0-preview</id>
53 <author>
54 <name>Bundle_Author</name>
55 <uri>http://mycompany.com/software</uri>
56 <email>Bundle_Author@mycompany.com</email>
57 </author>
58 <link rel="alternate" href="http://www.mycompany.com/content/view/software"/>
59 <link rel="enclosure" href="http://localhost:9999/wix4/BundleB/1.0-preview/BundleB.exe" length="10000" type="application/octet-stream"/>
60 <content type="html">
61 &lt;p&gt;Change list:&lt;/p&gt;&lt;ul&gt;
62 &lt;li&gt;Initial release.&lt;/li&gt;
63 &lt;/ul&gt;
64 </content>
65 <as:version>1.0.0.0</as:version>
66 <updated>2014-11-09T12:39:00.000Z</updated>
67 </entry>
68</feed>
diff --git a/src/test/DUtilUnitTest/precomp.h b/src/test/DUtilUnitTest/precomp.h
index f665fed1..e9f8770b 100644
--- a/src/test/DUtilUnitTest/precomp.h
+++ b/src/test/DUtilUnitTest/precomp.h
@@ -11,6 +11,8 @@
11#include "error.h" 11#include "error.h"
12#include <dutil.h> 12#include <dutil.h>
13 13
14#include <verutil.h>
15#include <atomutil.h>
14#include <dictutil.h> 16#include <dictutil.h>
15#include <dirutil.h> 17#include <dirutil.h>
16#include <fileutil.h> 18#include <fileutil.h>
@@ -21,8 +23,10 @@
21#include <strutil.h> 23#include <strutil.h>
22#include <monutil.h> 24#include <monutil.h>
23#include <regutil.h> 25#include <regutil.h>
26#include <rssutil.h>
27#include <apuputil.h> // NOTE: this must come after atomutil.h and rssutil.h since it uses them.
24#include <uriutil.h> 28#include <uriutil.h>
25#include <verutil.h> 29#include <xmlutil.h>
26 30
27#pragma managed 31#pragma managed
28#include <vcclr.h> 32#include <vcclr.h>