diff options
author | Bob Arnson <bob@firegiant.com> | 2024-05-15 22:11:57 -0400 |
---|---|---|
committer | Bob Arnson <github@bobs.org> | 2024-06-10 20:44:12 -0400 |
commit | 1a38763b97ce53fa99e1d16f739b93135698df41 (patch) | |
tree | 178605b56a73c52635c3b9c89178ea5e4567c9b0 /src/ext/Bal/test/WixToolsetTest.BootstrapperApplications/InternalUIBAFixture.cs | |
parent | eed1b5bbfb49d2425417bc342ecabe9edc206cdf (diff) | |
download | wix-1a38763b97ce53fa99e1d16f739b93135698df41.tar.gz wix-1a38763b97ce53fa99e1d16f739b93135698df41.tar.bz2 wix-1a38763b97ce53fa99e1d16f739b93135698df41.zip |
Add a IUIBA edge-case test and clean up a bit.
Diffstat (limited to 'src/ext/Bal/test/WixToolsetTest.BootstrapperApplications/InternalUIBAFixture.cs')
-rw-r--r-- | src/ext/Bal/test/WixToolsetTest.BootstrapperApplications/InternalUIBAFixture.cs | 70 |
1 files changed, 68 insertions, 2 deletions
diff --git a/src/ext/Bal/test/WixToolsetTest.BootstrapperApplications/InternalUIBAFixture.cs b/src/ext/Bal/test/WixToolsetTest.BootstrapperApplications/InternalUIBAFixture.cs index 7e64c13f..58d5d551 100644 --- a/src/ext/Bal/test/WixToolsetTest.BootstrapperApplications/InternalUIBAFixture.cs +++ b/src/ext/Bal/test/WixToolsetTest.BootstrapperApplications/InternalUIBAFixture.cs | |||
@@ -2,11 +2,11 @@ | |||
2 | 2 | ||
3 | namespace WixToolsetTest.BootstrapperApplications | 3 | namespace WixToolsetTest.BootstrapperApplications |
4 | { | 4 | { |
5 | using System; | ||
6 | using System.IO; | 5 | using System.IO; |
7 | using System.Linq; | 6 | using System.Linq; |
8 | using WixInternal.TestSupport; | 7 | using System.Xml; |
9 | using WixInternal.Core.TestPackage; | 8 | using WixInternal.Core.TestPackage; |
9 | using WixInternal.TestSupport; | ||
10 | using Xunit; | 10 | using Xunit; |
11 | 11 | ||
12 | public class InternalUIBAFixture | 12 | public class InternalUIBAFixture |
@@ -195,6 +195,72 @@ namespace WixToolsetTest.BootstrapperApplications | |||
195 | } | 195 | } |
196 | 196 | ||
197 | [Fact] | 197 | [Fact] |
198 | public void CanBuildUsingWixIuiBaAndForcedCachePrimaryPackage() | ||
199 | { | ||
200 | using (var fs = new DisposableFileSystem()) | ||
201 | { | ||
202 | var baseFolder = fs.GetFolder(); | ||
203 | var bundleFile = Path.Combine(baseFolder, "bin", "test.exe"); | ||
204 | var bundleSourceFolder = TestData.Get(@"TestData\WixIuiBa"); | ||
205 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
206 | var baFolderPath = Path.Combine(baseFolder, "ba"); | ||
207 | var extractFolderPath = Path.Combine(baseFolder, "extract"); | ||
208 | |||
209 | var compileResult = WixRunner.Execute(warningsAsErrors: false, new[] | ||
210 | { | ||
211 | "build", | ||
212 | Path.Combine(bundleSourceFolder, "CanForceCachePrimaryPackage.wxs"), | ||
213 | "-ext", TestData.Get(@"WixToolset.BootstrapperApplications.wixext.dll"), | ||
214 | "-intermediateFolder", intermediateFolder, | ||
215 | "-bindpath", TestData.Get(@"TestData\WixStdBa\Data"), | ||
216 | "-o", bundleFile, | ||
217 | }); | ||
218 | |||
219 | compileResult.AssertSuccess(); | ||
220 | |||
221 | Assert.True(File.Exists(bundleFile)); | ||
222 | |||
223 | var extractResult = BundleExtractor.ExtractBAContainer(null, bundleFile, baFolderPath, extractFolderPath); | ||
224 | extractResult.AssertSuccess(); | ||
225 | |||
226 | var wixPackageProperties = extractResult.SelectBADataNodes("/ba:BootstrapperApplicationData/ba:WixPackageProperties"); | ||
227 | AssertCacheType(wixPackageProperties[0]); | ||
228 | AssertCacheType(wixPackageProperties[1]); | ||
229 | |||
230 | var balPackageInfos = extractResult.GetBADataTestXmlLines("/ba:BootstrapperApplicationData/ba:WixBalPackageInfo"); | ||
231 | WixAssert.CompareLineByLine(new string[] | ||
232 | { | ||
233 | "<WixBalPackageInfo PackageId='test.msi' PrimaryPackageType='default' />", | ||
234 | }, balPackageInfos); | ||
235 | |||
236 | var mbaPrereqInfos = extractResult.GetBADataTestXmlLines("/ba:BootstrapperApplicationData/ba:WixPrereqInformation"); | ||
237 | WixAssert.CompareLineByLine(new[] | ||
238 | { | ||
239 | "<WixPrereqInformation PackageId='wixnative.exe' />", | ||
240 | }, mbaPrereqInfos); | ||
241 | |||
242 | Assert.True(File.Exists(Path.Combine(baFolderPath, "wixpreq.thm"))); | ||
243 | Assert.True(File.Exists(Path.Combine(baFolderPath, "wixpreq.wxl"))); | ||
244 | } | ||
245 | |||
246 | static void AssertCacheType(XmlNode node) | ||
247 | { | ||
248 | var element = node as XmlElement; | ||
249 | var package = element?.GetAttribute("Package"); | ||
250 | var cache = element?.GetAttribute("Cache"); | ||
251 | |||
252 | if (package == "test.msi") | ||
253 | { | ||
254 | Assert.Equal("force", cache); | ||
255 | } | ||
256 | else if (package == "wixnative.exe") | ||
257 | { | ||
258 | Assert.Equal("keep", cache); | ||
259 | } | ||
260 | } | ||
261 | } | ||
262 | |||
263 | [Fact] | ||
198 | public void CannotBuildUsingWixIuiBaWithAllPrereqPackages() | 264 | public void CannotBuildUsingWixIuiBaWithAllPrereqPackages() |
199 | { | 265 | { |
200 | using (var fs = new DisposableFileSystem()) | 266 | using (var fs = new DisposableFileSystem()) |