aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2020-03-26 15:21:06 +1000
committerSean Hall <r.sean.hall@gmail.com>2020-03-30 21:30:04 +1000
commitafbc6889c73d58136cb8851858ca3c17f41dc2c5 (patch)
tree1d7c66218176c7e8a28d49a4e22c60fe1e4e4c0d /src/test
parent192c5aa59b5d8e5e9df9095982317c224f3d4f04 (diff)
downloadwix-afbc6889c73d58136cb8851858ca3c17f41dc2c5.tar.gz
wix-afbc6889c73d58136cb8851858ca3c17f41dc2c5.tar.bz2
wix-afbc6889c73d58136cb8851858ca3c17f41dc2c5.zip
Add BundleExtension element.
Add GetTestXml. Fix issue with building with current version of burn.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/BundleManifestFixture.cs61
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/TestData/BundleExtension/BundleExtension.wxs6
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/TestData/BundleExtension/SimpleBundleExtension.wxs10
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/TestData/BundleWithPackageGroupRef/Bundle.wxs9
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/TestData/BundleWithPackageGroupRef/MinimalPackageGroup.wxs8
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/TestXmlFixture.cs62
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj4
7 files changed, 160 insertions, 0 deletions
diff --git a/src/test/WixToolsetTest.CoreIntegration/BundleManifestFixture.cs b/src/test/WixToolsetTest.CoreIntegration/BundleManifestFixture.cs
new file mode 100644
index 00000000..da4482ff
--- /dev/null
+++ b/src/test/WixToolsetTest.CoreIntegration/BundleManifestFixture.cs
@@ -0,0 +1,61 @@
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
3namespace WixToolsetTest.CoreIntegration
4{
5 using System.Collections.Generic;
6 using System.IO;
7 using WixBuildTools.TestSupport;
8 using WixToolset.Core.TestPackage;
9 using Xunit;
10
11 public class BundleManifestFixture
12 {
13 [Fact]
14 public void PopulatesManifestWithBundleExtension()
15 {
16 var burnStubPath = TestData.Get(@"TestData\.Data\burn.exe");
17 var folder = TestData.Get(@"TestData");
18
19 using (var fs = new DisposableFileSystem())
20 {
21 var baseFolder = fs.GetFolder();
22 var intermediateFolder = Path.Combine(baseFolder, "obj");
23 var bundlePath = Path.Combine(baseFolder, @"bin\test.exe");
24 var baFolderPath = Path.Combine(baseFolder, "ba");
25 var extractFolderPath = Path.Combine(baseFolder, "extract");
26
27 var result = WixRunner.Execute(new[]
28 {
29 "build",
30 Path.Combine(folder, "BundleExtension", "BundleExtension.wxs"),
31 Path.Combine(folder, "BundleExtension", "SimpleBundleExtension.wxs"),
32 Path.Combine(folder, "BundleWithPackageGroupRef", "MinimalPackageGroup.wxs"),
33 Path.Combine(folder, "BundleWithPackageGroupRef", "Bundle.wxs"),
34 "-bindpath", Path.Combine(folder, "SimpleBundle", "data"),
35 "-intermediateFolder", intermediateFolder,
36 "-burnStub", burnStubPath,
37 "-o", bundlePath
38 });
39
40 result.AssertSuccess();
41
42 Assert.True(File.Exists(bundlePath));
43
44 var extractResult = BundleExtractor.ExtractBAContainer(null, bundlePath, baFolderPath, extractFolderPath);
45 extractResult.AssertSuccess();
46
47 var bundleExtensions = extractResult.SelectManifestNodes("/burn:BurnManifest/burn:BundleExtension");
48 Assert.Equal(1, bundleExtensions.Count);
49 Assert.Equal("<BundleExtension Id='ExampleBext' EntryPayloadId='ExampleBext' />", bundleExtensions[0].GetTestXml());
50
51 var bundleExtensionPayloads = extractResult.SelectManifestNodes("/burn:BurnManifest/burn:UX/burn:Payload[@Id='ExampleBext']");
52 Assert.Equal(1, bundleExtensionPayloads.Count);
53 var ignored = new Dictionary<string, List<string>>
54 {
55 { "Payload", new List<string> { "FileSize", "Hash", "SourcePath" } },
56 };
57 Assert.Equal("<Payload Id='ExampleBext' FilePath='fakebext.dll' FileSize='*' Hash='*' Packaging='embedded' SourcePath='*' />", bundleExtensionPayloads[0].GetTestXml(ignored));
58 }
59 }
60 }
61}
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/BundleExtension/BundleExtension.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/BundleExtension/BundleExtension.wxs
new file mode 100644
index 00000000..eefae822
--- /dev/null
+++ b/src/test/WixToolsetTest.CoreIntegration/TestData/BundleExtension/BundleExtension.wxs
@@ -0,0 +1,6 @@
1<?xml version="1.0" encoding="utf-8"?>
2<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
3 <Fragment>
4 <BundleExtension Id="ExampleBext" SourceFile="fakeba.dll" Name="fakebext.dll" />
5 </Fragment>
6</Wix>
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/BundleExtension/SimpleBundleExtension.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/BundleExtension/SimpleBundleExtension.wxs
new file mode 100644
index 00000000..7303a05a
--- /dev/null
+++ b/src/test/WixToolsetTest.CoreIntegration/TestData/BundleExtension/SimpleBundleExtension.wxs
@@ -0,0 +1,10 @@
1<?xml version="1.0" encoding="utf-8"?>
2<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
3 <Fragment>
4 <PackageGroup Id="BundlePackages">
5 <PackageGroupRef Id="MinimalPackageGroup" />
6 </PackageGroup>
7
8 <BundleExtensionRef Id="ExampleBext" />
9 </Fragment>
10</Wix>
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/BundleWithPackageGroupRef/Bundle.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/BundleWithPackageGroupRef/Bundle.wxs
new file mode 100644
index 00000000..207a8de1
--- /dev/null
+++ b/src/test/WixToolsetTest.CoreIntegration/TestData/BundleWithPackageGroupRef/Bundle.wxs
@@ -0,0 +1,9 @@
1<?xml version="1.0" encoding="utf-8"?>
2<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
3 <Bundle Name="BurnBundle" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="B94478B1-E1F3-4700-9CE8-6AA090854AEC">
4 <BootstrapperApplication SourceFile="fakeba.dll" />
5 <Chain>
6 <PackageGroupRef Id="BundlePackages" />
7 </Chain>
8 </Bundle>
9</Wix>
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/BundleWithPackageGroupRef/MinimalPackageGroup.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/BundleWithPackageGroupRef/MinimalPackageGroup.wxs
new file mode 100644
index 00000000..b0bde4f6
--- /dev/null
+++ b/src/test/WixToolsetTest.CoreIntegration/TestData/BundleWithPackageGroupRef/MinimalPackageGroup.wxs
@@ -0,0 +1,8 @@
1<?xml version="1.0" encoding="utf-8"?>
2<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
3 <Fragment>
4 <PackageGroup Id="MinimalPackageGroup">
5 <MsiPackage SourceFile="test.msi" />
6 </PackageGroup>
7 </Fragment>
8</Wix>
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestXmlFixture.cs b/src/test/WixToolsetTest.CoreIntegration/TestXmlFixture.cs
new file mode 100644
index 00000000..5330305e
--- /dev/null
+++ b/src/test/WixToolsetTest.CoreIntegration/TestXmlFixture.cs
@@ -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
3namespace WixToolsetTest.CoreIntegration
4{
5 using System.Collections.Generic;
6 using WixToolset.Core.TestPackage;
7 using Xunit;
8
9 public class TestXmlFixture
10 {
11 [Fact]
12 public void ChangesIgnoredAttributesToStarToHelpMakeTestsLessFragile()
13 {
14 var original = @"<Top One='f'>
15 <First Two='t'>
16 <Target One='a' Two='b' Three='c' />
17 </First>
18 <Target One='z' Two='x' Three = 'y' />
19</Top>";
20 var expected = "<Top One='f'><First Two='t'><Target One='*' Two='*' Three='c' /></First><Target One='*' Two='*' Three='y' /></Top>";
21 var ignored = new Dictionary<string, List<string>> { { "Target", new List<string> { "One", "Two", "Missing" } } };
22 Assert.Equal(expected, original.GetTestXml(ignored));
23 }
24
25 [Fact]
26 public void OutputsSingleQuotesSinceDoubleQuotesInCsharpLiteralStringsArePainful()
27 {
28 var original = "<Test Simple=\"\" EscapedDoubleQuote=\"&quot;\" SingleQuoteValue=\"'test'\" Alternating='\"' AlternatingEscaped='&quot;' />";
29 var expected = "<Test Simple='' EscapedDoubleQuote='\"' SingleQuoteValue='&apos;test&apos;' Alternating='\"' AlternatingEscaped='\"' />";
30 Assert.Equal(expected, original.GetTestXml());
31 }
32
33 [Fact]
34 public void RemovesAllNamespacesToReduceTyping()
35 {
36 var original = "<Test xmlns='a'><Child xmlns:b='b'><Grandchild xmlns:c='c' /><Grandchild /></Child></Test>";
37 var expected = "<Test><Child><Grandchild /><Grandchild /></Child></Test>";
38 Assert.Equal(expected, original.GetTestXml());
39 }
40
41 [Fact]
42 public void RemovesUnnecessaryWhitespaceToAvoidLineEndingIssues()
43 {
44 var original = @"<Test>
45 <Child>
46 <Grandchild />
47 <Grandchild />
48 </Child>
49</Test>";
50 var expected = "<Test><Child><Grandchild /><Grandchild /></Child></Test>";
51 Assert.Equal(expected, original.GetTestXml());
52 }
53
54 [Fact]
55 public void RemovesXmlDeclarationToReduceTyping()
56 {
57 var original = "<?xml version='1.0'?><Test />";
58 var expected = "<Test />";
59 Assert.Equal(expected, original.GetTestXml());
60 }
61 }
62}
diff --git a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj
index 7f21fde1..85538b79 100644
--- a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj
+++ b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj
@@ -21,6 +21,10 @@
21 <Content Include="TestData\AppSearch\FileSearch.wxs" CopyToOutputDirectory="PreserveNewest" /> 21 <Content Include="TestData\AppSearch\FileSearch.wxs" CopyToOutputDirectory="PreserveNewest" />
22 <Content Include="TestData\AppSearch\NestedDirSearchUnderRegSearch.msi" CopyToOutputDirectory="PreserveNewest" /> 22 <Content Include="TestData\AppSearch\NestedDirSearchUnderRegSearch.msi" CopyToOutputDirectory="PreserveNewest" />
23 <Content Include="TestData\AppSearch\RegistrySearch.wxs" CopyToOutputDirectory="PreserveNewest" /> 23 <Content Include="TestData\AppSearch\RegistrySearch.wxs" CopyToOutputDirectory="PreserveNewest" />
24 <Content Include="TestData\BundleExtension\BundleExtension.wxs" CopyToOutputDirectory="PreserveNewest" />
25 <Content Include="TestData\BundleExtension\SimpleBundleExtension.wxs" CopyToOutputDirectory="PreserveNewest" />
26 <Content Include="TestData\BundleWithPackageGroupRef\Bundle.wxs" CopyToOutputDirectory="PreserveNewest" />
27 <Content Include="TestData\BundleWithPackageGroupRef\MinimalPackageGroup.wxs" CopyToOutputDirectory="PreserveNewest" />
24 <Content Include="TestData\Class\DecompiledOldClassTableDef.wxs" CopyToOutputDirectory="PreserveNewest" /> 28 <Content Include="TestData\Class\DecompiledOldClassTableDef.wxs" CopyToOutputDirectory="PreserveNewest" />
25 <Content Include="TestData\Class\IconIndex0.wxs" CopyToOutputDirectory="PreserveNewest" /> 29 <Content Include="TestData\Class\IconIndex0.wxs" CopyToOutputDirectory="PreserveNewest" />
26 <Content Include="TestData\Class\OldClassTableDef.msi" CopyToOutputDirectory="PreserveNewest" /> 30 <Content Include="TestData\Class\OldClassTableDef.msi" CopyToOutputDirectory="PreserveNewest" />