From d085e938317c80f62a3b484d20ed1a6cf89bb59d Mon Sep 17 00:00:00 2001 From: Nir Bar Date: Mon, 21 Dec 2020 05:05:45 -0600 Subject: Add CanExtractBundleWithDetachedContainer test. --- .../BundleExtractionFixture.cs | 57 ++++++++++++++++++++++ .../BundleWithDetachedContainer/Bundle.wxs | 10 ++++ .../WixToolsetTest.CoreIntegration.csproj | 1 + 3 files changed, 68 insertions(+) create mode 100644 src/test/WixToolsetTest.CoreIntegration/BundleExtractionFixture.cs create mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/BundleWithDetachedContainer/Bundle.wxs (limited to 'src/test/WixToolsetTest.CoreIntegration') diff --git a/src/test/WixToolsetTest.CoreIntegration/BundleExtractionFixture.cs b/src/test/WixToolsetTest.CoreIntegration/BundleExtractionFixture.cs new file mode 100644 index 00000000..5c37c25b --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/BundleExtractionFixture.cs @@ -0,0 +1,57 @@ +// 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.IO; + using System.Linq; + using WixBuildTools.TestSupport; + using WixToolset.Core; + using WixToolset.Core.TestPackage; + using WixToolset.Data; + using Xunit; + + public class BundleExtractionFixture + { + [Fact] + public void CanExtractBundleWithDetachedContainer() + { + var folder = TestData.Get(@"TestData"); + + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var intermediateFolder = Path.Combine(baseFolder, "obj"); + var exePath = Path.Combine(baseFolder, @"bin\test.exe"); + var pdbPath = Path.Combine(baseFolder, @"bin\test.wixpdb"); + var extractFolderPath = Path.Combine(baseFolder, "extract"); + var baFolderPath = Path.Combine(extractFolderPath, "UX"); + var attachedContainerFolderPath = Path.Combine(extractFolderPath, "AttachedContainer"); + + // TODO: use WixRunner.Execute(string[]) to always go through the command line. + var serviceProvider = WixToolsetServiceProviderFactory.CreateServiceProvider(); + var result = WixRunner.Execute(new[] + { + "build", + Path.Combine(folder, "BundleWithDetachedContainer", "Bundle.wxs"), + Path.Combine(folder, "BundleWithPackageGroupRef", "Bundle.wxs"), + Path.Combine(folder, "BundleWithPackageGroupRef", "MinimalPackageGroup.wxs"), + "-bindpath", Path.Combine(folder, "SimpleBundle", "data"), + "-bindpath", Path.Combine(folder, ".Data"), + "-intermediateFolder", intermediateFolder, + "-o", exePath, + }, serviceProvider, out var messages).Result; + + WixRunnerResult.AssertSuccess(result, messages); + Assert.Empty(messages.Where(m => m.Level == MessageLevel.Warning)); + + Assert.True(File.Exists(exePath)); + + var unbinder = serviceProvider.GetService(); + unbinder.Unbind(exePath, OutputType.Bundle, extractFolderPath); + + Assert.True(File.Exists(Path.Combine(baFolderPath, "manifest.xml"))); + Assert.False(Directory.Exists(attachedContainerFolderPath)); + } + } + } +} diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/BundleWithDetachedContainer/Bundle.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/BundleWithDetachedContainer/Bundle.wxs new file mode 100644 index 00000000..a93b23ef --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/BundleWithDetachedContainer/Bundle.wxs @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj index a38e89ce..918635e9 100644 --- a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj +++ b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj @@ -32,6 +32,7 @@ + -- cgit v1.2.3-55-g6feb