From afbc6889c73d58136cb8851858ca3c17f41dc2c5 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Thu, 26 Mar 2020 15:21:06 +1000 Subject: Add BundleExtension element. Add GetTestXml. Fix issue with building with current version of burn. --- .../BundleManifestFixture.cs | 61 +++++++++++++++++++++ .../TestData/BundleExtension/BundleExtension.wxs | 6 +++ .../BundleExtension/SimpleBundleExtension.wxs | 10 ++++ .../TestData/BundleWithPackageGroupRef/Bundle.wxs | 9 ++++ .../MinimalPackageGroup.wxs | 8 +++ .../TestXmlFixture.cs | 62 ++++++++++++++++++++++ .../WixToolsetTest.CoreIntegration.csproj | 4 ++ 7 files changed, 160 insertions(+) create mode 100644 src/test/WixToolsetTest.CoreIntegration/BundleManifestFixture.cs create mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/BundleExtension/BundleExtension.wxs create mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/BundleExtension/SimpleBundleExtension.wxs create mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/BundleWithPackageGroupRef/Bundle.wxs create mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/BundleWithPackageGroupRef/MinimalPackageGroup.wxs create mode 100644 src/test/WixToolsetTest.CoreIntegration/TestXmlFixture.cs (limited to 'src/test/WixToolsetTest.CoreIntegration') 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 @@ +// 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. + +namespace WixToolsetTest.CoreIntegration +{ + using System.Collections.Generic; + using System.IO; + using WixBuildTools.TestSupport; + using WixToolset.Core.TestPackage; + using Xunit; + + public class BundleManifestFixture + { + [Fact] + public void PopulatesManifestWithBundleExtension() + { + var burnStubPath = TestData.Get(@"TestData\.Data\burn.exe"); + var folder = TestData.Get(@"TestData"); + + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var intermediateFolder = Path.Combine(baseFolder, "obj"); + var bundlePath = Path.Combine(baseFolder, @"bin\test.exe"); + var baFolderPath = Path.Combine(baseFolder, "ba"); + var extractFolderPath = Path.Combine(baseFolder, "extract"); + + var result = WixRunner.Execute(new[] + { + "build", + Path.Combine(folder, "BundleExtension", "BundleExtension.wxs"), + Path.Combine(folder, "BundleExtension", "SimpleBundleExtension.wxs"), + Path.Combine(folder, "BundleWithPackageGroupRef", "MinimalPackageGroup.wxs"), + Path.Combine(folder, "BundleWithPackageGroupRef", "Bundle.wxs"), + "-bindpath", Path.Combine(folder, "SimpleBundle", "data"), + "-intermediateFolder", intermediateFolder, + "-burnStub", burnStubPath, + "-o", bundlePath + }); + + result.AssertSuccess(); + + Assert.True(File.Exists(bundlePath)); + + var extractResult = BundleExtractor.ExtractBAContainer(null, bundlePath, baFolderPath, extractFolderPath); + extractResult.AssertSuccess(); + + var bundleExtensions = extractResult.SelectManifestNodes("/burn:BurnManifest/burn:BundleExtension"); + Assert.Equal(1, bundleExtensions.Count); + Assert.Equal("", bundleExtensions[0].GetTestXml()); + + var bundleExtensionPayloads = extractResult.SelectManifestNodes("/burn:BurnManifest/burn:UX/burn:Payload[@Id='ExampleBext']"); + Assert.Equal(1, bundleExtensionPayloads.Count); + var ignored = new Dictionary> + { + { "Payload", new List { "FileSize", "Hash", "SourcePath" } }, + }; + Assert.Equal("", bundleExtensionPayloads[0].GetTestXml(ignored)); + } + } + } +} 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 @@ + + + + + + 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 @@ + + + + + + + + + + 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 @@ + + + + + + + + + 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 @@ + + + + + + + + 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 @@ +// 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. + +namespace WixToolsetTest.CoreIntegration +{ + using System.Collections.Generic; + using WixToolset.Core.TestPackage; + using Xunit; + + public class TestXmlFixture + { + [Fact] + public void ChangesIgnoredAttributesToStarToHelpMakeTestsLessFragile() + { + var original = @" + + + + +"; + var expected = ""; + var ignored = new Dictionary> { { "Target", new List { "One", "Two", "Missing" } } }; + Assert.Equal(expected, original.GetTestXml(ignored)); + } + + [Fact] + public void OutputsSingleQuotesSinceDoubleQuotesInCsharpLiteralStringsArePainful() + { + var original = ""; + var expected = ""; + Assert.Equal(expected, original.GetTestXml()); + } + + [Fact] + public void RemovesAllNamespacesToReduceTyping() + { + var original = ""; + var expected = ""; + Assert.Equal(expected, original.GetTestXml()); + } + + [Fact] + public void RemovesUnnecessaryWhitespaceToAvoidLineEndingIssues() + { + var original = @" + + + + +"; + var expected = ""; + Assert.Equal(expected, original.GetTestXml()); + } + + [Fact] + public void RemovesXmlDeclarationToReduceTyping() + { + var original = ""; + var expected = ""; + Assert.Equal(expected, original.GetTestXml()); + } + } +} 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 @@ + + + + -- cgit v1.2.3-55-g6feb