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/test | |
parent | 85deb61f666f6817c1a137ace4d666c8ae2940fb (diff) | |
download | wix-d085e938317c80f62a3b484d20ed1a6cf89bb59d.tar.gz wix-d085e938317c80f62a3b484d20ed1a6cf89bb59d.tar.bz2 wix-d085e938317c80f62a3b484d20ed1a6cf89bb59d.zip |
Add CanExtractBundleWithDetachedContainer test.
Diffstat (limited to 'src/test')
3 files changed, 68 insertions, 0 deletions
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 @@ | |||
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 WixBuildTools.TestSupport; | ||
8 | using WixToolset.Core; | ||
9 | using WixToolset.Core.TestPackage; | ||
10 | using WixToolset.Data; | ||
11 | using Xunit; | ||
12 | |||
13 | public class BundleExtractionFixture | ||
14 | { | ||
15 | [Fact] | ||
16 | public void CanExtractBundleWithDetachedContainer() | ||
17 | { | ||
18 | var folder = TestData.Get(@"TestData"); | ||
19 | |||
20 | using (var fs = new DisposableFileSystem()) | ||
21 | { | ||
22 | var baseFolder = fs.GetFolder(); | ||
23 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
24 | var exePath = Path.Combine(baseFolder, @"bin\test.exe"); | ||
25 | var pdbPath = Path.Combine(baseFolder, @"bin\test.wixpdb"); | ||
26 | var extractFolderPath = Path.Combine(baseFolder, "extract"); | ||
27 | var baFolderPath = Path.Combine(extractFolderPath, "UX"); | ||
28 | var attachedContainerFolderPath = Path.Combine(extractFolderPath, "AttachedContainer"); | ||
29 | |||
30 | // TODO: use WixRunner.Execute(string[]) to always go through the command line. | ||
31 | var serviceProvider = WixToolsetServiceProviderFactory.CreateServiceProvider(); | ||
32 | var result = WixRunner.Execute(new[] | ||
33 | { | ||
34 | "build", | ||
35 | Path.Combine(folder, "BundleWithDetachedContainer", "Bundle.wxs"), | ||
36 | Path.Combine(folder, "BundleWithPackageGroupRef", "Bundle.wxs"), | ||
37 | Path.Combine(folder, "BundleWithPackageGroupRef", "MinimalPackageGroup.wxs"), | ||
38 | "-bindpath", Path.Combine(folder, "SimpleBundle", "data"), | ||
39 | "-bindpath", Path.Combine(folder, ".Data"), | ||
40 | "-intermediateFolder", intermediateFolder, | ||
41 | "-o", exePath, | ||
42 | }, serviceProvider, out var messages).Result; | ||
43 | |||
44 | WixRunnerResult.AssertSuccess(result, messages); | ||
45 | Assert.Empty(messages.Where(m => m.Level == MessageLevel.Warning)); | ||
46 | |||
47 | Assert.True(File.Exists(exePath)); | ||
48 | |||
49 | var unbinder = serviceProvider.GetService<IUnbinder>(); | ||
50 | unbinder.Unbind(exePath, OutputType.Bundle, extractFolderPath); | ||
51 | |||
52 | Assert.True(File.Exists(Path.Combine(baFolderPath, "manifest.xml"))); | ||
53 | Assert.False(Directory.Exists(attachedContainerFolderPath)); | ||
54 | } | ||
55 | } | ||
56 | } | ||
57 | } | ||
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 @@ | |||
1 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
2 | <Fragment> | ||
3 | <PackageGroup Id="BundlePackages"> | ||
4 | <PackageGroupRef Id="MinimalPackageGroup"/> | ||
5 | </PackageGroup> | ||
6 | <Container Id="_1" Type="detached"> | ||
7 | <PackageGroupRef Id="MinimalPackageGroup"/> | ||
8 | </Container> | ||
9 | </Fragment> | ||
10 | </Wix> \ 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 @@ | |||
32 | <Content Include="TestData\BundleExtension\BundleExtensionSearches.wxs" CopyToOutputDirectory="PreserveNewest" /> | 32 | <Content Include="TestData\BundleExtension\BundleExtensionSearches.wxs" CopyToOutputDirectory="PreserveNewest" /> |
33 | <Content Include="TestData\BundleExtension\BundleWithSearches.wxs" CopyToOutputDirectory="PreserveNewest" /> | 33 | <Content Include="TestData\BundleExtension\BundleWithSearches.wxs" CopyToOutputDirectory="PreserveNewest" /> |
34 | <Content Include="TestData\BundleExtension\SimpleBundleExtension.wxs" CopyToOutputDirectory="PreserveNewest" /> | 34 | <Content Include="TestData\BundleExtension\SimpleBundleExtension.wxs" CopyToOutputDirectory="PreserveNewest" /> |
35 | <Content Include="TestData\BundleWithDetachedContainer\Bundle.wxs" CopyToOutputDirectory="PreserveNewest" /> | ||
35 | <Content Include="TestData\BundleWithPackageGroupRef\Bundle.wxs" CopyToOutputDirectory="PreserveNewest" /> | 36 | <Content Include="TestData\BundleWithPackageGroupRef\Bundle.wxs" CopyToOutputDirectory="PreserveNewest" /> |
36 | <Content Include="TestData\BundleWithPackageGroupRef\MinimalPackageGroup.wxs" CopyToOutputDirectory="PreserveNewest" /> | 37 | <Content Include="TestData\BundleWithPackageGroupRef\MinimalPackageGroup.wxs" CopyToOutputDirectory="PreserveNewest" /> |
37 | <Content Include="TestData\Class\DecompiledOldClassTableDef.wxs" CopyToOutputDirectory="PreserveNewest" /> | 38 | <Content Include="TestData\Class\DecompiledOldClassTableDef.wxs" CopyToOutputDirectory="PreserveNewest" /> |