Add failing test for when EnsureTable references an extension table with a different name than its tuple.
Sean Hall committed
Apr 3, 2020 at 16:14 UTC
a26c9ac0e9b02360b298ae5c619ca4070d11ae9a
5 files changed
+52
-3
src/test/Example.Extension/ExampleTableDefinitions.cs
+3
-2
@@ -1,4 +1,4 @@
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.
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 Example.Extension
4
{
@@ -7,7 +7,8 @@ namespace Example.Extension
7
public static class ExampleTableDefinitions
8
{
9
public static readonly TableDefinition ExampleTable = new TableDefinition(
10
- "Example",
10
+ "Wix4Example",
11
+ ExampleTupleDefinitions.Example.Name,
12
new[]
13
{
14
new ColumnDefinition("Example", ColumnType.String, 72, true, false, ColumnCategory.Identifier),
src/test/Example.Extension/ExampleWindowsInstallerBackendExtension.cs
+4
-1
@@ -1,13 +1,16 @@
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.
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 Example.Extension
4
{
5
+ using System.Collections.Generic;
6
using WixToolset.Data;
7
using WixToolset.Data.WindowsInstaller;
8
using WixToolset.Extensibility;
9
10
internal class ExampleWindowsInstallerBackendExtension : BaseWindowsInstallerBackendBinderExtension
11
{
12
+ public override IEnumerable<TableDefinition> TableDefinitions => ExampleTableDefinitions.All;
13
+
14
public override bool TryAddTupleToOutput(IntermediateTuple tuple, WindowsInstallerData output)
15
{
16
#if ALTERNATIVE_TO_USING_HELPER
src/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs
+34
@@ -2,8 +2,10 @@
2
3
namespace WixToolsetTest.CoreIntegration
4
{
5
+ using System;
6
using System.IO;
7
using System.Linq;
8
+ using Example.Extension;
9
using WixBuildTools.TestSupport;
10
using WixToolset.Core.TestPackage;
11
using Xunit;
@@ -526,6 +528,38 @@ namespace WixToolsetTest.CoreIntegration
528
}
529
}
530
531
+ [Fact]
532
+ public void PopulatesExampleTableBecauseOfEnsureTable()
533
+ {
534
+ var folder = TestData.Get(@"TestData");
535
+ var extensionPath = Path.GetFullPath(new Uri(typeof(ExampleExtensionFactory).Assembly.CodeBase).LocalPath);
536
+
537
+ using (var fs = new DisposableFileSystem())
538
+ {
539
+ var baseFolder = fs.GetFolder();
540
+ var intermediateFolder = Path.Combine(baseFolder, "obj");
541
+ var msiPath = Path.Combine(baseFolder, @"bin\test.msi");
542
+
543
+ var result = WixRunner.Execute(new[]
544
+ {
545
+ "build",
546
+ Path.Combine(folder, "EnsureTable", "EnsureTable.wxs"),
547
+ Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"),
548
+ Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"),
549
+ "-ext", extensionPath,
550
+ "-bindpath", Path.Combine(folder, "SingleFile", "data"),
551
+ "-intermediateFolder", intermediateFolder,
552
+ "-o", msiPath
553
+ });
554
+
555
+ result.AssertSuccess();
556
+
557
+ Assert.True(File.Exists(msiPath));
558
+ var results = Query.QueryDatabaseByTable(msiPath, new[] { "Wix4Example" });
559
+ Assert.Empty(results["Wix4Example"]);
560
+ }
561
+ }
562
+
563
[Fact]
564
public void PopulatesFeatureTableWithParent()
565
{
src/test/WixToolsetTest.CoreIntegration/TestData/EnsureTable/EnsureTable.wxs
new
+10
@@ -0,0 +1,10 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
3
+ <Fragment>
4
+ <ComponentGroup Id="ProductComponents">
5
+ <ComponentGroupRef Id="MinimalComponentGroup" />
6
+ </ComponentGroup>
7
+
8
+ <EnsureTable Id="Wix4Example" />
9
+ </Fragment>
10
+</Wix>
src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj
+1
@@ -37,6 +37,7 @@
37
<Content Include="TestData\DialogsInInstallUISequence\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" />
38
<Content Include="TestData\DialogsInInstallUISequence\Package.wxs" CopyToOutputDirectory="PreserveNewest" />
39
<Content Include="TestData\DialogsInInstallUISequence\PackageComponents.wxs" CopyToOutputDirectory="PreserveNewest" />
40
+ <Content Include="TestData\EnsureTable\EnsureTable.wxs" CopyToOutputDirectory="PreserveNewest" />
41
<Content Include="TestData\Environment\Environment.wxs" CopyToOutputDirectory="PreserveNewest" />
42
<Content Include="TestData\ErrorsInUI\data\test.txt" CopyToOutputDirectory="PreserveNewest" />
43
<Content Include="TestData\ErrorsInUI\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" />