diff options
author | chris_bednarski <Chris.Bednarski@minfos.com.au> | 2023-07-22 09:01:55 +1000 |
---|---|---|
committer | Bob Arnson <github@bobs.org> | 2023-07-23 20:23:58 -0400 |
commit | 5e9901d7be4953333b0f2c3a25e8eb484d5673d6 (patch) | |
tree | ba12e683f7c89299f605ebec6330204d316850af /src | |
parent | 1c50eb8ac6d693b910eb2bd1d44526d9e3f10c50 (diff) | |
download | wix-5e9901d7be4953333b0f2c3a25e8eb484d5673d6.tar.gz wix-5e9901d7be4953333b0f2c3a25e8eb484d5673d6.tar.bz2 wix-5e9901d7be4953333b0f2c3a25e8eb484d5673d6.zip |
Multiple extension support in unit tests
Diffstat (limited to 'src')
4 files changed, 31 insertions, 13 deletions
diff --git a/src/internal/WixInternal.TestSupport/Builder.cs b/src/internal/WixInternal.TestSupport/Builder.cs index 78804826..51b7bb0a 100644 --- a/src/internal/WixInternal.TestSupport/Builder.cs +++ b/src/internal/WixInternal.TestSupport/Builder.cs | |||
@@ -11,14 +11,29 @@ namespace WixInternal.TestSupport | |||
11 | public Builder(string sourceFolder, Type extensionType = null, string[] bindPaths = null, string outputFile = null) | 11 | public Builder(string sourceFolder, Type extensionType = null, string[] bindPaths = null, string outputFile = null) |
12 | { | 12 | { |
13 | this.SourceFolder = sourceFolder; | 13 | this.SourceFolder = sourceFolder; |
14 | this.ExtensionType = extensionType; | 14 | if (extensionType != null) |
15 | { | ||
16 | this.ExtensionTypes = new Type[] { extensionType }; | ||
17 | } | ||
18 | else | ||
19 | { | ||
20 | this.ExtensionTypes = new Type[] { }; | ||
21 | } | ||
22 | this.BindPaths = bindPaths; | ||
23 | this.OutputFile = outputFile ?? "test.msi"; | ||
24 | } | ||
25 | |||
26 | public Builder(string sourceFolder, Type[] extensionTypes, string[] bindPaths = null, string outputFile = null) | ||
27 | { | ||
28 | this.SourceFolder = sourceFolder; | ||
29 | this.ExtensionTypes = extensionTypes; | ||
15 | this.BindPaths = bindPaths; | 30 | this.BindPaths = bindPaths; |
16 | this.OutputFile = outputFile ?? "test.msi"; | 31 | this.OutputFile = outputFile ?? "test.msi"; |
17 | } | 32 | } |
18 | 33 | ||
19 | public string[] BindPaths { get; set; } | 34 | public string[] BindPaths { get; set; } |
20 | 35 | ||
21 | public Type ExtensionType { get; set; } | 36 | public Type[] ExtensionTypes { get; set; } |
22 | 37 | ||
23 | public string OutputFile { get; set; } | 38 | public string OutputFile { get; set; } |
24 | 39 | ||
@@ -46,10 +61,10 @@ namespace WixInternal.TestSupport | |||
46 | "-intermediateFolder", intermediateFolder, | 61 | "-intermediateFolder", intermediateFolder, |
47 | }; | 62 | }; |
48 | 63 | ||
49 | if (this.ExtensionType != null) | 64 | foreach (var ext in this.ExtensionTypes) |
50 | { | 65 | { |
51 | args.Add("-ext"); | 66 | args.Add("-ext"); |
52 | args.Add(Path.GetFullPath(new Uri(this.ExtensionType.Assembly.CodeBase).LocalPath)); | 67 | args.Add(Path.GetFullPath(new Uri(ext.Assembly.CodeBase).LocalPath)); |
53 | } | 68 | } |
54 | 69 | ||
55 | args.AddRange(sourceFiles); | 70 | args.AddRange(sourceFiles); |
@@ -108,10 +123,10 @@ namespace WixInternal.TestSupport | |||
108 | "-intermediateFolder", intermediateFolder, | 123 | "-intermediateFolder", intermediateFolder, |
109 | }; | 124 | }; |
110 | 125 | ||
111 | if (this.ExtensionType != null) | 126 | foreach (var ext in this.ExtensionTypes) |
112 | { | 127 | { |
113 | firstBuildArgs.Add("-ext"); | 128 | firstBuildArgs.Add("-ext"); |
114 | firstBuildArgs.Add(Path.GetFullPath(new Uri(this.ExtensionType.Assembly.CodeBase).LocalPath)); | 129 | firstBuildArgs.Add(Path.GetFullPath(new Uri(ext.Assembly.CodeBase).LocalPath)); |
115 | } | 130 | } |
116 | 131 | ||
117 | firstBuildArgs.AddRange(sourceFiles); | 132 | firstBuildArgs.AddRange(sourceFiles); |
@@ -140,10 +155,10 @@ namespace WixInternal.TestSupport | |||
140 | "-o", decompilePath | 155 | "-o", decompilePath |
141 | }; | 156 | }; |
142 | 157 | ||
143 | if (this.ExtensionType != null) | 158 | foreach (var ext in this.ExtensionTypes) |
144 | { | 159 | { |
145 | decompileArgs.Add("-ext"); | 160 | decompileArgs.Add("-ext"); |
146 | decompileArgs.Add(Path.GetFullPath(new Uri(this.ExtensionType.Assembly.CodeBase).LocalPath)); | 161 | decompileArgs.Add(Path.GetFullPath(new Uri(ext.Assembly.CodeBase).LocalPath)); |
147 | } | 162 | } |
148 | 163 | ||
149 | decompileFunc(decompileArgs.ToArray()); | 164 | decompileFunc(decompileArgs.ToArray()); |
@@ -157,10 +172,10 @@ namespace WixInternal.TestSupport | |||
157 | "-intermediateFolder", decompileIntermediateFolder | 172 | "-intermediateFolder", decompileIntermediateFolder |
158 | }; | 173 | }; |
159 | 174 | ||
160 | if (this.ExtensionType != null) | 175 | foreach (var ext in this.ExtensionTypes) |
161 | { | 176 | { |
162 | secondBuildArgs.Add("-ext"); | 177 | secondBuildArgs.Add("-ext"); |
163 | secondBuildArgs.Add(Path.GetFullPath(new Uri(this.ExtensionType.Assembly.CodeBase).LocalPath)); | 178 | secondBuildArgs.Add(Path.GetFullPath(new Uri(ext.Assembly.CodeBase).LocalPath)); |
164 | } | 179 | } |
165 | 180 | ||
166 | secondBuildArgs.Add("-bindpath"); | 181 | secondBuildArgs.Add("-bindpath"); |
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/DependencyExtensionFixture.cs b/src/wix/test/WixToolsetTest.CoreIntegration/DependencyExtensionFixture.cs index 915e1594..2d774a70 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/DependencyExtensionFixture.cs +++ b/src/wix/test/WixToolsetTest.CoreIntegration/DependencyExtensionFixture.cs | |||
@@ -2,6 +2,7 @@ | |||
2 | 2 | ||
3 | namespace WixToolsetTest.CoreIntegration | 3 | namespace WixToolsetTest.CoreIntegration |
4 | { | 4 | { |
5 | using System; | ||
5 | using System.Collections.Generic; | 6 | using System.Collections.Generic; |
6 | using System.IO; | 7 | using System.IO; |
7 | using System.Linq; | 8 | using System.Linq; |
@@ -152,7 +153,7 @@ namespace WixToolsetTest.CoreIntegration | |||
152 | public void CanBuildPackageUsingProvides() | 153 | public void CanBuildPackageUsingProvides() |
153 | { | 154 | { |
154 | var folder = TestData.Get(@"TestData\UsingProvides"); | 155 | var folder = TestData.Get(@"TestData\UsingProvides"); |
155 | var build = new Builder(folder, null, new[] { folder }); | 156 | var build = new Builder(folder, new Type[] { }, new[] { folder }); |
156 | 157 | ||
157 | var results = build.BuildAndQuery(Build, "Wix4DependencyProvider"); | 158 | var results = build.BuildAndQuery(Build, "Wix4DependencyProvider"); |
158 | WixAssert.CompareLineByLine(new[] | 159 | WixAssert.CompareLineByLine(new[] |
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/SoftwareTagFixture.cs b/src/wix/test/WixToolsetTest.CoreIntegration/SoftwareTagFixture.cs index a98e4683..4f297b7e 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/SoftwareTagFixture.cs +++ b/src/wix/test/WixToolsetTest.CoreIntegration/SoftwareTagFixture.cs | |||
@@ -2,6 +2,7 @@ | |||
2 | 2 | ||
3 | namespace WixToolsetTest.CoreIntegration | 3 | namespace WixToolsetTest.CoreIntegration |
4 | { | 4 | { |
5 | using System; | ||
5 | using System.IO; | 6 | using System.IO; |
6 | using System.Linq; | 7 | using System.Linq; |
7 | using System.Xml.Linq; | 8 | using System.Xml.Linq; |
@@ -19,7 +20,7 @@ namespace WixToolsetTest.CoreIntegration | |||
19 | public void CanBuildPackageWithTag() | 20 | public void CanBuildPackageWithTag() |
20 | { | 21 | { |
21 | var folder = TestData.Get(@"TestData\ProductTag"); | 22 | var folder = TestData.Get(@"TestData\ProductTag"); |
22 | var build = new Builder(folder, null, new[] { folder }); | 23 | var build = new Builder(folder, new Type[] { }, new[] { folder }); |
23 | 24 | ||
24 | var results = build.BuildAndQuery(Build, "File", "SoftwareIdentificationTag"); | 25 | var results = build.BuildAndQuery(Build, "File", "SoftwareIdentificationTag"); |
25 | 26 | ||
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/UpgradeFixture.cs b/src/wix/test/WixToolsetTest.CoreIntegration/UpgradeFixture.cs index 7d0883f8..3d2aa722 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/UpgradeFixture.cs +++ b/src/wix/test/WixToolsetTest.CoreIntegration/UpgradeFixture.cs | |||
@@ -2,6 +2,7 @@ | |||
2 | 2 | ||
3 | namespace WixToolsetTest.CoreIntegration | 3 | namespace WixToolsetTest.CoreIntegration |
4 | { | 4 | { |
5 | using System; | ||
5 | using System.IO; | 6 | using System.IO; |
6 | using System.Linq; | 7 | using System.Linq; |
7 | using WixInternal.TestSupport; | 8 | using WixInternal.TestSupport; |
@@ -45,7 +46,7 @@ namespace WixToolsetTest.CoreIntegration | |||
45 | public void MajorUpgradeDowngradeMessagePopulatesRowsAsExpected() | 46 | public void MajorUpgradeDowngradeMessagePopulatesRowsAsExpected() |
46 | { | 47 | { |
47 | var folder = TestData.Get("TestData", "Upgrade"); | 48 | var folder = TestData.Get("TestData", "Upgrade"); |
48 | var build = new Builder(folder, null, new[] { folder }); | 49 | var build = new Builder(folder, new Type[] { }, new[] { folder }); |
49 | 50 | ||
50 | var results = build.BuildAndQuery(Build, "Upgrade", "LaunchCondition"); | 51 | var results = build.BuildAndQuery(Build, "Upgrade", "LaunchCondition"); |
51 | WixAssert.CompareLineByLine(new[] | 52 | WixAssert.CompareLineByLine(new[] |