From 9ca5e0a95d0858a177fe1efdc15a962e5f7c1d84 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Fri, 18 Oct 2019 10:50:34 +1000 Subject: Add failing test for decompiler with database that has old schemas and missing foreign key relationships. --- .../DecompileFixture.cs | 31 +++++++++++++++++++++ .../TestData/Class/DecompiledOldClassTableDef.wxs | 27 ++++++++++++++++++ .../TestData/Class/OldClassTableDef.msi | Bin 0 -> 36864 bytes .../WixToolsetTest.CoreIntegration.csproj | 2 ++ 4 files changed, 60 insertions(+) create mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/Class/DecompiledOldClassTableDef.wxs create mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/Class/OldClassTableDef.msi (limited to 'src/test') diff --git a/src/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs b/src/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs index 3a9781df..bace97b3 100644 --- a/src/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs @@ -65,5 +65,36 @@ namespace WixToolsetTest.CoreIntegration Assert.Equal(expected, actualFormatted); } } + + [Fact(Skip = "Test demonstrates failure")] + public void CanDecompileOldClassTableDefinition() + { + // The input MSI was not created using standard methods, it is an example of a real world database that needs to be decompiled. + // The Class/@Feature_ column has length of 32, the File/@Attributes has length of 2, + // and numerous foreign key relationships are missing. + var folder = TestData.Get(@"TestData\Class"); + + using (var fs = new DisposableFileSystem()) + { + var intermediateFolder = fs.GetFolder(); + var outputPath = Path.Combine(intermediateFolder, @"Actual.wxs"); + + var result = WixRunner.Execute(new[] + { + "decompile", + Path.Combine(folder, "OldClassTableDef.msi"), + "-intermediateFolder", intermediateFolder, + "-o", outputPath + }); + + result.AssertSuccess(); + + var actual = File.ReadAllText(outputPath); + var actualFormatted = XDocument.Parse(actual, LoadOptions.PreserveWhitespace | LoadOptions.SetBaseUri | LoadOptions.SetLineInfo).ToString(); + var expected = XDocument.Load(Path.Combine(folder, "DecompiledOldClassTableDef.wxs"), LoadOptions.PreserveWhitespace | LoadOptions.SetBaseUri | LoadOptions.SetLineInfo).ToString(); + + Assert.Equal(expected, actualFormatted); + } + } } } diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/Class/DecompiledOldClassTableDef.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/Class/DecompiledOldClassTableDef.wxs new file mode 100644 index 00000000..86d41c50 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/Class/DecompiledOldClassTableDef.wxs @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/Class/OldClassTableDef.msi b/src/test/WixToolsetTest.CoreIntegration/TestData/Class/OldClassTableDef.msi new file mode 100644 index 00000000..2cd10f09 Binary files /dev/null and b/src/test/WixToolsetTest.CoreIntegration/TestData/Class/OldClassTableDef.msi differ diff --git a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj index 770f528a..ab6f8d98 100644 --- a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj +++ b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj @@ -18,7 +18,9 @@ + + -- cgit v1.2.3-55-g6feb