diff options
| author | Nir Bar <nir.bar@panel-sw.co.il> | 2020-12-21 05:05:45 -0600 |
|---|---|---|
| committer | Sean Hall <r.sean.hall@gmail.com> | 2020-12-21 16:49:04 -0600 |
| commit | d085e938317c80f62a3b484d20ed1a6cf89bb59d (patch) | |
| tree | d993e2bf90bc754d62b9731981b3cb056e1bb7b9 /src/WixToolset.Core.TestPackage | |
| parent | 85deb61f666f6817c1a137ace4d666c8ae2940fb (diff) | |
| download | wix-d085e938317c80f62a3b484d20ed1a6cf89bb59d.tar.gz wix-d085e938317c80f62a3b484d20ed1a6cf89bb59d.tar.bz2 wix-d085e938317c80f62a3b484d20ed1a6cf89bb59d.zip | |
Add CanExtractBundleWithDetachedContainer test.
Diffstat (limited to 'src/WixToolset.Core.TestPackage')
| -rw-r--r-- | src/WixToolset.Core.TestPackage/BundleExtractor.cs | 17 | ||||
| -rw-r--r-- | src/WixToolset.Core.TestPackage/WixRunnerResult.cs | 12 |
2 files changed, 28 insertions, 1 deletions
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 | |||
| @@ -45,6 +45,23 @@ namespace WixToolset.Core.TestPackage | |||
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | /// <summary> | 47 | /// <summary> |
| 48 | /// Extracts the attached container. | ||
| 49 | /// </summary> | ||
| 50 | /// <param name="messaging"></param> | ||
| 51 | /// <param name="bundleFilePath">Path to the bundle.</param> | ||
| 52 | /// <param name="destinationFolderPath">Path to extract to.</param> | ||
| 53 | /// <param name="tempFolderPath">Temp path for extraction.</param> | ||
| 54 | /// <returns>True if there was an attached container.</returns> | ||
| 55 | public static bool ExtractAttachedContainer(IMessaging messaging, string bundleFilePath, string destinationFolderPath, string tempFolderPath) | ||
| 56 | { | ||
| 57 | Directory.CreateDirectory(tempFolderPath); | ||
| 58 | using (var burnReader = BurnReader.Open(messaging, bundleFilePath)) | ||
| 59 | { | ||
| 60 | return burnReader.ExtractAttachedContainer(destinationFolderPath, tempFolderPath); | ||
| 61 | } | ||
| 62 | } | ||
| 63 | |||
| 64 | /// <summary> | ||
| 48 | /// Gets an <see cref="XmlNamespaceManager"/> for BootstrapperApplicationData.xml with the given prefix assigned to the root namespace. | 65 | /// Gets an <see cref="XmlNamespaceManager"/> for BootstrapperApplicationData.xml with the given prefix assigned to the root namespace. |
| 49 | /// </summary> | 66 | /// </summary> |
| 50 | /// <param name="document"></param> | 67 | /// <param name="document"></param> |
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 | |||
| 28 | /// <returns></returns> | 28 | /// <returns></returns> |
| 29 | public WixRunnerResult AssertSuccess() | 29 | public WixRunnerResult AssertSuccess() |
| 30 | { | 30 | { |
| 31 | 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"); | 31 | AssertSuccess(this.ExitCode, this.Messages); |
| 32 | return this; | 32 | return this; |
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | /// <summary> | ||
| 36 | /// | ||
| 37 | /// </summary> | ||
| 38 | /// <param name="exitCode"></param> | ||
| 39 | /// <param name="messages"></param> | ||
| 40 | public static void AssertSuccess(int exitCode, IEnumerable<Message> messages) | ||
| 41 | { | ||
| 42 | Assert.True(0 == exitCode, $"\r\n\r\nWixRunner failed with exit code: {exitCode}\r\n Output: {String.Join("\r\n ", FormatMessages(messages))}\r\n"); | ||
| 43 | } | ||
| 44 | |||
| 35 | private static IEnumerable<string> FormatMessages(IEnumerable<Message> messages) | 45 | private static IEnumerable<string> FormatMessages(IEnumerable<Message> messages) |
| 36 | { | 46 | { |
| 37 | foreach (var message in messages) | 47 | foreach (var message in messages) |
