diff options
author | Rob Mensching <rob@firegiant.com> | 2017-12-07 14:19:05 -0800 |
---|---|---|
committer | Rob Mensching <rob@firegiant.com> | 2017-12-07 14:19:05 -0800 |
commit | 49f1209035aac1fcfad5dbbe25f7b2306d3be86c (patch) | |
tree | 6ce5921493eb751b6d89c3faf0ebdf64110cbb65 /src/test | |
parent | b1e662bd480241ea914f0f3d6bd174d9ffd03f5f (diff) | |
download | wix-49f1209035aac1fcfad5dbbe25f7b2306d3be86c.tar.gz wix-49f1209035aac1fcfad5dbbe25f7b2306d3be86c.tar.bz2 wix-49f1209035aac1fcfad5dbbe25f7b2306d3be86c.zip |
Support MSI backends creating custom tables and remove WixToolset.Data.WindowsInstaller
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/TestData/Example.Extension/ExampleExtensionData.cs | 2 | ||||
-rw-r--r-- | src/test/TestData/Example.Extension/ExampleExtensionFactory.cs | 4 | ||||
-rw-r--r-- | src/test/TestData/Example.Extension/ExampleTableDefinitions.cs | 21 | ||||
-rw-r--r-- | src/test/TestData/Example.Extension/ExampleTuple.cs | 4 | ||||
-rw-r--r-- | src/test/TestData/Example.Extension/ExampleTupleDefinitions.cs (renamed from src/test/TestData/Example.Extension/TupleDefinitions.cs) | 6 | ||||
-rw-r--r-- | src/test/TestData/Example.Extension/ExampleWindowsInstallerBackendExtension.cs | 32 | ||||
-rw-r--r-- | src/test/WixToolsetTest.CoreIntegration/ProgramFixture.cs | 1 |
7 files changed, 65 insertions, 5 deletions
diff --git a/src/test/TestData/Example.Extension/ExampleExtensionData.cs b/src/test/TestData/Example.Extension/ExampleExtensionData.cs index 6b179ea6..724f9eea 100644 --- a/src/test/TestData/Example.Extension/ExampleExtensionData.cs +++ b/src/test/TestData/Example.Extension/ExampleExtensionData.cs | |||
@@ -19,7 +19,7 @@ namespace Example.Extension | |||
19 | switch (name) | 19 | switch (name) |
20 | { | 20 | { |
21 | case "Example": | 21 | case "Example": |
22 | tupleDefinition = TupleDefinitions.Example; | 22 | tupleDefinition = ExampleTupleDefinitions.Example; |
23 | break; | 23 | break; |
24 | 24 | ||
25 | default: | 25 | default: |
diff --git a/src/test/TestData/Example.Extension/ExampleExtensionFactory.cs b/src/test/TestData/Example.Extension/ExampleExtensionFactory.cs index b91d06e9..a081b758 100644 --- a/src/test/TestData/Example.Extension/ExampleExtensionFactory.cs +++ b/src/test/TestData/Example.Extension/ExampleExtensionFactory.cs | |||
@@ -28,6 +28,10 @@ namespace Example.Extension | |||
28 | { | 28 | { |
29 | extension = new ExampleExtensionData(); | 29 | extension = new ExampleExtensionData(); |
30 | } | 30 | } |
31 | else if (extensionType == typeof(IWindowsInstallerBackendExtension)) | ||
32 | { | ||
33 | extension = new ExampleWindowsInstallerBackendExtension(); | ||
34 | } | ||
31 | else | 35 | else |
32 | { | 36 | { |
33 | extension = null; | 37 | extension = null; |
diff --git a/src/test/TestData/Example.Extension/ExampleTableDefinitions.cs b/src/test/TestData/Example.Extension/ExampleTableDefinitions.cs new file mode 100644 index 00000000..870b02e1 --- /dev/null +++ b/src/test/TestData/Example.Extension/ExampleTableDefinitions.cs | |||
@@ -0,0 +1,21 @@ | |||
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.WindowsInstaller; | ||
7 | |||
8 | public static class ExampleTableDefinitions | ||
9 | { | ||
10 | public static readonly TableDefinition ExampleTable = new TableDefinition( | ||
11 | "Example", | ||
12 | new List<ColumnDefinition> | ||
13 | { | ||
14 | new ColumnDefinition("Example", ColumnType.String, 72, true, false, ColumnCategory.Identifier), | ||
15 | new ColumnDefinition("Value", ColumnType.String, 0, false, false, ColumnCategory.Formatted), | ||
16 | } | ||
17 | ); | ||
18 | |||
19 | public static readonly TableDefinition[] All = new[] { ExampleTable }; | ||
20 | } | ||
21 | } | ||
diff --git a/src/test/TestData/Example.Extension/ExampleTuple.cs b/src/test/TestData/Example.Extension/ExampleTuple.cs index f280a5c8..0fc0d82c 100644 --- a/src/test/TestData/Example.Extension/ExampleTuple.cs +++ b/src/test/TestData/Example.Extension/ExampleTuple.cs | |||
@@ -12,11 +12,11 @@ namespace Example.Extension | |||
12 | 12 | ||
13 | public class ExampleTuple : IntermediateTuple | 13 | public class ExampleTuple : IntermediateTuple |
14 | { | 14 | { |
15 | public ExampleTuple() : base(TupleDefinitions.Example, null, null) | 15 | public ExampleTuple() : base(ExampleTupleDefinitions.Example, null, null) |
16 | { | 16 | { |
17 | } | 17 | } |
18 | 18 | ||
19 | public ExampleTuple(SourceLineNumber sourceLineNumber, Identifier id = null) : base(TupleDefinitions.Example, sourceLineNumber, id) | 19 | public ExampleTuple(SourceLineNumber sourceLineNumber, Identifier id = null) : base(ExampleTupleDefinitions.Example, sourceLineNumber, id) |
20 | { | 20 | { |
21 | } | 21 | } |
22 | 22 | ||
diff --git a/src/test/TestData/Example.Extension/TupleDefinitions.cs b/src/test/TestData/Example.Extension/ExampleTupleDefinitions.cs index 2c320fbc..4775b827 100644 --- a/src/test/TestData/Example.Extension/TupleDefinitions.cs +++ b/src/test/TestData/Example.Extension/ExampleTupleDefinitions.cs | |||
@@ -4,10 +4,12 @@ namespace Example.Extension | |||
4 | { | 4 | { |
5 | using WixToolset.Data; | 5 | using WixToolset.Data; |
6 | 6 | ||
7 | public static class TupleDefinitions | 7 | public static class ExampleTupleDefinitions |
8 | { | 8 | { |
9 | public const string ExampleName = "Example"; | ||
10 | |||
9 | public static readonly IntermediateTupleDefinition Example = new IntermediateTupleDefinition( | 11 | public static readonly IntermediateTupleDefinition Example = new IntermediateTupleDefinition( |
10 | "Example", | 12 | ExampleName, |
11 | new[] | 13 | new[] |
12 | { | 14 | { |
13 | new IntermediateFieldDefinition(nameof(ExampleTupleFields.Example), IntermediateFieldType.String), | 15 | new IntermediateFieldDefinition(nameof(ExampleTupleFields.Example), IntermediateFieldType.String), |
diff --git a/src/test/TestData/Example.Extension/ExampleWindowsInstallerBackendExtension.cs b/src/test/TestData/Example.Extension/ExampleWindowsInstallerBackendExtension.cs new file mode 100644 index 00000000..f00a5102 --- /dev/null +++ b/src/test/TestData/Example.Extension/ExampleWindowsInstallerBackendExtension.cs | |||
@@ -0,0 +1,32 @@ | |||
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 WixToolset.Data; | ||
6 | using WixToolset.Data.WindowsInstaller; | ||
7 | using WixToolset.Extensibility; | ||
8 | |||
9 | internal class ExampleWindowsInstallerBackendExtension : BaseWindowsInstallerBackendExtension | ||
10 | { | ||
11 | public override bool TryAddTupleToOutput(IntermediateTuple tuple, Output output) | ||
12 | { | ||
13 | #if ALTERNATIVE_TO_USING_HELPER | ||
14 | switch (tuple.Definition.Name) | ||
15 | { | ||
16 | case TupleDefinitions.ExampleName: | ||
17 | { | ||
18 | var table = output.EnsureTable(ExampleTableDefinitions.ExampleTable); | ||
19 | var row = table.CreateRow(tuple.SourceLineNumbers); | ||
20 | row[0] = tuple[0].AsString(); | ||
21 | row[1] = tuple[1].AsString(); | ||
22 | } | ||
23 | return true; | ||
24 | } | ||
25 | |||
26 | return false; | ||
27 | #else | ||
28 | return this.BackendHelper.TryAddTupleToOutputMatchingTableDefinitions(tuple, output, ExampleTableDefinitions.All); | ||
29 | #endif | ||
30 | } | ||
31 | } | ||
32 | } | ||
diff --git a/src/test/WixToolsetTest.CoreIntegration/ProgramFixture.cs b/src/test/WixToolsetTest.CoreIntegration/ProgramFixture.cs index d99f53ec..8c603588 100644 --- a/src/test/WixToolsetTest.CoreIntegration/ProgramFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/ProgramFixture.cs | |||
@@ -7,6 +7,7 @@ namespace WixToolsetTest.CoreIntegration | |||
7 | using WixToolset.Core; | 7 | using WixToolset.Core; |
8 | using WixToolset.Data; | 8 | using WixToolset.Data; |
9 | using WixToolset.Data.Tuples; | 9 | using WixToolset.Data.Tuples; |
10 | using WixToolset.Data.WindowsInstaller; | ||
10 | using WixToolsetTest.CoreIntegration.Utility; | 11 | using WixToolsetTest.CoreIntegration.Utility; |
11 | using Xunit; | 12 | using Xunit; |
12 | 13 | ||