diff options
| author | Rob Mensching <rob@firegiant.com> | 2021-05-03 15:55:48 -0700 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2021-05-03 15:55:48 -0700 |
| commit | ba7bab476501c16e437b0aee71c1be02c3dda176 (patch) | |
| tree | 814fba485c29a7dfe1adb396169e27ed641ef9a3 /src/ext/Bal/test/WixToolsetTest.Bal/BalExtensionFixture.cs | |
| parent | 14987a72cc1a3493ca8f80693d273352fc314bd9 (diff) | |
| download | wix-ba7bab476501c16e437b0aee71c1be02c3dda176.tar.gz wix-ba7bab476501c16e437b0aee71c1be02c3dda176.tar.bz2 wix-ba7bab476501c16e437b0aee71c1be02c3dda176.zip | |
Move Bal.wixext into ext
Diffstat (limited to 'src/ext/Bal/test/WixToolsetTest.Bal/BalExtensionFixture.cs')
| -rw-r--r-- | src/ext/Bal/test/WixToolsetTest.Bal/BalExtensionFixture.cs | 133 |
1 files changed, 133 insertions, 0 deletions
diff --git a/src/ext/Bal/test/WixToolsetTest.Bal/BalExtensionFixture.cs b/src/ext/Bal/test/WixToolsetTest.Bal/BalExtensionFixture.cs new file mode 100644 index 00000000..2ff57c55 --- /dev/null +++ b/src/ext/Bal/test/WixToolsetTest.Bal/BalExtensionFixture.cs | |||
| @@ -0,0 +1,133 @@ | |||
| 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 WixToolsetTest.Bal | ||
| 4 | { | ||
| 5 | using System.IO; | ||
| 6 | using System.Linq; | ||
| 7 | using System.Xml; | ||
| 8 | using WixBuildTools.TestSupport; | ||
| 9 | using WixToolset.Core.TestPackage; | ||
| 10 | using Xunit; | ||
| 11 | |||
| 12 | public class BalExtensionFixture | ||
| 13 | { | ||
| 14 | [Fact] | ||
| 15 | public void CanBuildUsingDisplayInternalUICondition() | ||
| 16 | { | ||
| 17 | using (var fs = new DisposableFileSystem()) | ||
| 18 | { | ||
| 19 | var baseFolder = fs.GetFolder(); | ||
| 20 | var bundleFile = Path.Combine(baseFolder, "bin", "test.exe"); | ||
| 21 | var bundleSourceFolder = TestData.Get(@"TestData\WixStdBa"); | ||
| 22 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
| 23 | var baFolderPath = Path.Combine(baseFolder, "ba"); | ||
| 24 | var extractFolderPath = Path.Combine(baseFolder, "extract"); | ||
| 25 | |||
| 26 | var compileResult = WixRunner.Execute(new[] | ||
| 27 | { | ||
| 28 | "build", | ||
| 29 | Path.Combine(bundleSourceFolder, "DisplayInternalUIConditionBundle.wxs"), | ||
| 30 | "-ext", TestData.Get(@"WixToolset.Bal.wixext.dll"), | ||
| 31 | "-intermediateFolder", intermediateFolder, | ||
| 32 | "-bindpath", Path.Combine(bundleSourceFolder, "data"), | ||
| 33 | "-o", bundleFile, | ||
| 34 | }); | ||
| 35 | compileResult.AssertSuccess(); | ||
| 36 | |||
| 37 | Assert.True(File.Exists(bundleFile)); | ||
| 38 | |||
| 39 | var extractResult = BundleExtractor.ExtractBAContainer(null, bundleFile, baFolderPath, extractFolderPath); | ||
| 40 | extractResult.AssertSuccess(); | ||
| 41 | |||
| 42 | var balPackageInfos = extractResult.SelectBADataNodes("/ba:BootstrapperApplicationData/ba:WixBalPackageInfo"); | ||
| 43 | var balPackageInfo = (XmlNode)Assert.Single(balPackageInfos); | ||
| 44 | Assert.Equal("<WixBalPackageInfo PackageId='test.msi' DisplayInternalUICondition='1' />", balPackageInfo.GetTestXml()); | ||
| 45 | |||
| 46 | Assert.True(File.Exists(Path.Combine(baFolderPath, "thm.wxl"))); | ||
| 47 | } | ||
| 48 | } | ||
| 49 | |||
| 50 | [Fact] | ||
| 51 | public void CanBuildUsingOverridable() | ||
| 52 | { | ||
| 53 | using (var fs = new DisposableFileSystem()) | ||
| 54 | { | ||
| 55 | var baseFolder = fs.GetFolder(); | ||
| 56 | var bundleFile = Path.Combine(baseFolder, "bin", "test.exe"); | ||
| 57 | var bundleSourceFolder = TestData.Get(@"TestData\Overridable"); | ||
| 58 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
| 59 | var baFolderPath = Path.Combine(baseFolder, "ba"); | ||
| 60 | var extractFolderPath = Path.Combine(baseFolder, "extract"); | ||
| 61 | |||
| 62 | var compileResult = WixRunner.Execute(new[] | ||
| 63 | { | ||
| 64 | "build", | ||
| 65 | Path.Combine(bundleSourceFolder, "Bundle.wxs"), | ||
| 66 | "-ext", TestData.Get(@"WixToolset.Bal.wixext.dll"), | ||
| 67 | "-intermediateFolder", intermediateFolder, | ||
| 68 | "-o", bundleFile, | ||
| 69 | }); | ||
| 70 | compileResult.AssertSuccess(); | ||
| 71 | |||
| 72 | Assert.True(File.Exists(bundleFile)); | ||
| 73 | |||
| 74 | var extractResult = BundleExtractor.ExtractBAContainer(null, bundleFile, baFolderPath, extractFolderPath); | ||
| 75 | extractResult.AssertSuccess(); | ||
| 76 | |||
| 77 | var balOverridableVariables = extractResult.SelectBADataNodes("/ba:BootstrapperApplicationData/ba:WixStdbaOverridableVariable"); | ||
| 78 | var balOverridableVariable = (XmlNode)Assert.Single(balOverridableVariables); | ||
| 79 | Assert.Equal("<WixStdbaOverridableVariable Name='Test1' />", balOverridableVariable.GetTestXml()); | ||
| 80 | } | ||
| 81 | } | ||
| 82 | |||
| 83 | [Fact] | ||
| 84 | public void CanBuildUsingWixStdBa() | ||
| 85 | { | ||
| 86 | using (var fs = new DisposableFileSystem()) | ||
| 87 | { | ||
| 88 | var baseFolder = fs.GetFolder(); | ||
| 89 | var bundleFile = Path.Combine(baseFolder, "bin", "test.exe"); | ||
| 90 | var bundleSourceFolder = TestData.Get(@"TestData\WixStdBa"); | ||
| 91 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
| 92 | |||
| 93 | var compileResult = WixRunner.Execute(new[] | ||
| 94 | { | ||
| 95 | "build", | ||
| 96 | Path.Combine(bundleSourceFolder, "Bundle.wxs"), | ||
| 97 | "-ext", TestData.Get(@"WixToolset.Bal.wixext.dll"), | ||
| 98 | "-intermediateFolder", intermediateFolder, | ||
| 99 | "-o", bundleFile, | ||
| 100 | }); | ||
| 101 | compileResult.AssertSuccess(); | ||
| 102 | |||
| 103 | Assert.True(File.Exists(bundleFile)); | ||
| 104 | } | ||
| 105 | } | ||
| 106 | |||
| 107 | [Fact] | ||
| 108 | public void CantBuildUsingMBAWithNoPrereqs() | ||
| 109 | { | ||
| 110 | using (var fs = new DisposableFileSystem()) | ||
| 111 | { | ||
| 112 | var baseFolder = fs.GetFolder(); | ||
| 113 | var bundleFile = Path.Combine(baseFolder, "bin", "test.exe"); | ||
| 114 | var bundleSourceFolder = TestData.Get(@"TestData\MBA"); | ||
| 115 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
| 116 | |||
| 117 | var compileResult = WixRunner.Execute(new[] | ||
| 118 | { | ||
| 119 | "build", | ||
| 120 | Path.Combine(bundleSourceFolder, "Bundle.wxs"), | ||
| 121 | "-ext", TestData.Get(@"WixToolset.Bal.wixext.dll"), | ||
| 122 | "-intermediateFolder", intermediateFolder, | ||
| 123 | "-o", bundleFile, | ||
| 124 | }); | ||
| 125 | Assert.Equal(6802, compileResult.ExitCode); | ||
| 126 | Assert.Equal("There must be at least one PrereqPackage when using the ManagedBootstrapperApplicationHost.\nThis is typically done by using the WixNetFxExtension and referencing one of the NetFxAsPrereq package groups.", compileResult.Messages[0].ToString()); | ||
| 127 | |||
| 128 | Assert.False(File.Exists(bundleFile)); | ||
| 129 | Assert.False(File.Exists(Path.Combine(intermediateFolder, "test.exe"))); | ||
| 130 | } | ||
| 131 | } | ||
| 132 | } | ||
| 133 | } | ||
