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. --- src/WixToolset.Core.TestPackage/BundleExtractor.cs | 17 +++++++++++++++++ src/WixToolset.Core.TestPackage/WixRunnerResult.cs | 12 +++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) (limited to 'src/WixToolset.Core.TestPackage') diff --git a/src/WixToolset.Core.TestPackage/BundleExtractor.cs b/src/WixToolset.Core.TestPackage/BundleExtractor.cs index ad97f113..8c9f31e6 100644 --- a/src/WixToolset.Core.TestPackage/BundleExtractor.cs +++ b/src/WixToolset.Core.TestPackage/BundleExtractor.cs @@ -44,6 +44,23 @@ namespace WixToolset.Core.TestPackage return result; } + /// + /// Extracts the attached container. + /// + /// + /// Path to the bundle. + /// Path to extract to. + /// Temp path for extraction. + /// True if there was an attached container. + public static bool ExtractAttachedContainer(IMessaging messaging, string bundleFilePath, string destinationFolderPath, string tempFolderPath) + { + Directory.CreateDirectory(tempFolderPath); + using (var burnReader = BurnReader.Open(messaging, bundleFilePath)) + { + return burnReader.ExtractAttachedContainer(destinationFolderPath, tempFolderPath); + } + } + /// /// Gets an for BootstrapperApplicationData.xml with the given prefix assigned to the root namespace. /// diff --git a/src/WixToolset.Core.TestPackage/WixRunnerResult.cs b/src/WixToolset.Core.TestPackage/WixRunnerResult.cs index 13e3a9e0..6a3d714c 100644 --- a/src/WixToolset.Core.TestPackage/WixRunnerResult.cs +++ b/src/WixToolset.Core.TestPackage/WixRunnerResult.cs @@ -28,10 +28,20 @@ namespace WixToolset.Core.TestPackage /// public WixRunnerResult AssertSuccess() { - Assert.True(0 == this.ExitCode, $"\r\n\r\nWixRunner failed with exit code: {this.ExitCode}\r\n Output: {String.Join("\r\n ", FormatMessages(this.Messages))}\r\n"); + AssertSuccess(this.ExitCode, this.Messages); return this; } + /// + /// + /// + /// + /// + public static void AssertSuccess(int exitCode, IEnumerable messages) + { + Assert.True(0 == exitCode, $"\r\n\r\nWixRunner failed with exit code: {exitCode}\r\n Output: {String.Join("\r\n ", FormatMessages(messages))}\r\n"); + } + private static IEnumerable FormatMessages(IEnumerable messages) { foreach (var message in messages) -- cgit v1.2.3-55-g6feb