| 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 | |
| 3 | namespace WixToolsetTest.CoreIntegration |
| 4 | { |
| 5 | using System.IO; |
| 6 | using System.Linq; |
| 7 | using WixInternal.TestSupport; |
| 8 | using WixInternal.Core.TestPackage; |
| 9 | using WixToolset.Data; |
| 10 | using Xunit; |
| 11 | |
| 12 | public class BundleExtractionFixture |
| 13 | { |
| 14 | [Fact] |
| 15 | public void CanExtractBundleWithDetachedContainer() |
| 16 | { |
| 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 exePath = Path.Combine(baseFolder, @"bin\test.exe"); |
| 24 | var extractFolderPath = Path.Combine(baseFolder, "extract"); |
| 25 | var baFolderPath = Path.Combine(extractFolderPath, "BA"); |
| 26 | var attachedContainerFolderPath = Path.Combine(extractFolderPath, "WixAttachedContainer"); |
| 27 | |
| 28 | var result = WixRunner.Execute(new[] |
| 29 | { |
| 30 | "build", |
| 31 | Path.Combine(folder, "BundleWithDetachedContainer", "Bundle.wxs"), |
| 32 | Path.Combine(folder, "BundleWithPackageGroupRef", "Bundle.wxs"), |
| 33 | Path.Combine(folder, "BundleWithPackageGroupRef", "MinimalPackageGroup.wxs"), |
| 34 | "-bindpath", Path.Combine(folder, "SimpleBundle", "data"), |
| 35 | "-bindpath", Path.Combine(folder, ".Data"), |
| 36 | "-intermediateFolder", intermediateFolder, |
| 37 | "-o", exePath, |
| 38 | }); |
| 39 | |
| 40 | result.AssertSuccess(); |
| 41 | Assert.Empty(result.Messages.Where(m => m.Level == MessageLevel.Warning)); |
| 42 | |
| 43 | Assert.True(File.Exists(exePath)); |
| 44 | |
| 45 | result = WixRunner.Execute(new[] |
| 46 | { |
| 47 | "burn", "extract", |
| 48 | exePath, |
| 49 | "-oba", baFolderPath, |
| 50 | "-o", extractFolderPath |
| 51 | }); |
| 52 | |
| 53 | result.AssertSuccess(); |
| 54 | |
| 55 | Assert.True(File.Exists(Path.Combine(baFolderPath, "manifest.xml"))); |
| 56 | Assert.False(Directory.Exists(attachedContainerFolderPath)); |
| 57 | } |
| 58 | } |
| 59 | } |
| 60 | } |