diff options
Diffstat (limited to 'src/test')
5 files changed, 65 insertions, 0 deletions
diff --git a/src/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs b/src/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs new file mode 100644 index 00000000..66ce98c0 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs | |||
@@ -0,0 +1,41 @@ | |||
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.Xml.Linq; | ||
7 | using WixBuildTools.TestSupport; | ||
8 | using WixToolset.Core.TestPackage; | ||
9 | using Xunit; | ||
10 | |||
11 | public class DecompileFixture | ||
12 | { | ||
13 | [Fact] | ||
14 | public void CanDecompileSingleFileCompressed() | ||
15 | { | ||
16 | var folder = TestData.Get(@"TestData\DecompileSingleFileCompressed"); | ||
17 | |||
18 | using (var fs = new DisposableFileSystem()) | ||
19 | { | ||
20 | var intermediateFolder = fs.GetFolder(); | ||
21 | var outputPath = Path.Combine(intermediateFolder, @"Actual.wxs"); | ||
22 | |||
23 | var result = WixRunner.Execute(new[] | ||
24 | { | ||
25 | "decompile", | ||
26 | Path.Combine(folder, "example.msi"), | ||
27 | "-intermediateFolder", intermediateFolder, | ||
28 | "-o", outputPath | ||
29 | }); | ||
30 | |||
31 | result.AssertSuccess(); | ||
32 | |||
33 | var actual = File.ReadAllText(outputPath); | ||
34 | var actualFormatted = XDocument.Parse(actual, LoadOptions.PreserveWhitespace | LoadOptions.SetBaseUri | LoadOptions.SetLineInfo).ToString(); | ||
35 | var expected = XDocument.Load(Path.Combine(folder, "Expected.wxs"), LoadOptions.PreserveWhitespace | LoadOptions.SetBaseUri | LoadOptions.SetLineInfo).ToString(); | ||
36 | |||
37 | Assert.Equal(expected, actualFormatted); | ||
38 | } | ||
39 | } | ||
40 | } | ||
41 | } | ||
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/DecompileSingleFileCompressed/Expected.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/DecompileSingleFileCompressed/Expected.wxs new file mode 100644 index 00000000..b2bb6050 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/DecompileSingleFileCompressed/Expected.wxs | |||
@@ -0,0 +1,21 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
3 | <Product Id="{6F9B5694-F0F1-437C-919B-0D2DAF2D9DEA}" Codepage="65001" Language="1033" Manufacturer="Example Corporation" Name="MsiPackage" UpgradeCode="{047730A5-30FE-4A62-A520-DA9381B8226A}" Version="1.0.0.0"> | ||
4 | <Package Compressed="yes" Description="MsiPackage" InstallerVersion="200" Languages="1033" Manufacturer="Example Corporation" Platform="x86" /> | ||
5 | <Directory Id="TARGETDIR" Name="SourceDir"> | ||
6 | <Directory Id="ProgramFilesFolder"> | ||
7 | <Directory Id="INSTALLFOLDER" Name="MsiPackage" ShortName="oekcr5lq"> | ||
8 | <Component Id="filcV1yrx0x8wJWj4qMzcH21jwkPko" Guid="{E597A58A-03CB-50D8-93E3-DABA263F233A}"> | ||
9 | <File Id="filcV1yrx0x8wJWj4qMzcH21jwkPko" Name="test.txt" KeyPath="yes" Source="SourceDir\File\filcV1yrx0x8wJWj4qMzcH21jwkPko" /> | ||
10 | </Component> | ||
11 | </Directory> | ||
12 | </Directory> | ||
13 | </Directory> | ||
14 | <Feature Id="ProductFeature" Level="1" Title="MsiPackage"> | ||
15 | <ComponentRef Id="filcV1yrx0x8wJWj4qMzcH21jwkPko" /> | ||
16 | </Feature> | ||
17 | <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." /> | ||
18 | <Media Id="1" Cabinet="example.cab" /> | ||
19 | <Property Id="ALLUSERS" Value="1" /> | ||
20 | </Product> | ||
21 | </Wix> \ No newline at end of file | ||
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/DecompileSingleFileCompressed/example.cab b/src/test/WixToolsetTest.CoreIntegration/TestData/DecompileSingleFileCompressed/example.cab new file mode 100644 index 00000000..125eeb2c --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/DecompileSingleFileCompressed/example.cab | |||
Binary files differ | |||
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/DecompileSingleFileCompressed/example.msi b/src/test/WixToolsetTest.CoreIntegration/TestData/DecompileSingleFileCompressed/example.msi new file mode 100644 index 00000000..9cb6d6bc --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/DecompileSingleFileCompressed/example.msi | |||
Binary files differ | |||
diff --git a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj index 38b7dc81..7f1337e0 100644 --- a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj +++ b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj | |||
@@ -20,6 +20,9 @@ | |||
20 | <Content Include="TestData\InstanceTransform\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" /> | 20 | <Content Include="TestData\InstanceTransform\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" /> |
21 | <Content Include="TestData\InstanceTransform\Package.wxs" CopyToOutputDirectory="PreserveNewest" /> | 21 | <Content Include="TestData\InstanceTransform\Package.wxs" CopyToOutputDirectory="PreserveNewest" /> |
22 | <Content Include="TestData\InstanceTransform\PackageComponents.wxs" CopyToOutputDirectory="PreserveNewest" /> | 22 | <Content Include="TestData\InstanceTransform\PackageComponents.wxs" CopyToOutputDirectory="PreserveNewest" /> |
23 | <Content Include="TestData\DecompileSingleFileCompressed\example.cab" CopyToOutputDirectory="PreserveNewest" /> | ||
24 | <Content Include="TestData\DecompileSingleFileCompressed\example.msi" CopyToOutputDirectory="PreserveNewest" /> | ||
25 | <Content Include="TestData\DecompileSingleFileCompressed\Expected.wxs" CopyToOutputDirectory="PreserveNewest" /> | ||
23 | <Content Include="TestData\ExampleExtension\data\example.txt" CopyToOutputDirectory="PreserveNewest" /> | 26 | <Content Include="TestData\ExampleExtension\data\example.txt" CopyToOutputDirectory="PreserveNewest" /> |
24 | <Content Include="TestData\ExampleExtension\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" /> | 27 | <Content Include="TestData\ExampleExtension\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" /> |
25 | <Content Include="TestData\ExampleExtension\Package.wxs" CopyToOutputDirectory="PreserveNewest" /> | 28 | <Content Include="TestData\ExampleExtension\Package.wxs" CopyToOutputDirectory="PreserveNewest" /> |