diff options
| author | Rob Mensching <rob@firegiant.com> | 2024-03-06 14:48:10 -0800 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2024-03-07 10:55:57 -0800 |
| commit | 3d2d46f62fc01e2653d0251ad9703090574e7c41 (patch) | |
| tree | ffdf7dce6c646f38b5e3ad8325c2ce78ca891a1a /src/ext/Bal/test/WixToolsetTest.BootstrapperApplications/BalExtensionFixture.cs | |
| parent | a8504dc4eb1c2d09965b0858699ac737336ef3c1 (diff) | |
| download | wix-3d2d46f62fc01e2653d0251ad9703090574e7c41.tar.gz wix-3d2d46f62fc01e2653d0251ad9703090574e7c41.tar.bz2 wix-3d2d46f62fc01e2653d0251ad9703090574e7c41.zip | |
Better .nupkg names
Diffstat (limited to 'src/ext/Bal/test/WixToolsetTest.BootstrapperApplications/BalExtensionFixture.cs')
| -rw-r--r-- | src/ext/Bal/test/WixToolsetTest.BootstrapperApplications/BalExtensionFixture.cs | 262 |
1 files changed, 262 insertions, 0 deletions
diff --git a/src/ext/Bal/test/WixToolsetTest.BootstrapperApplications/BalExtensionFixture.cs b/src/ext/Bal/test/WixToolsetTest.BootstrapperApplications/BalExtensionFixture.cs new file mode 100644 index 00000000..a9460008 --- /dev/null +++ b/src/ext/Bal/test/WixToolsetTest.BootstrapperApplications/BalExtensionFixture.cs | |||
| @@ -0,0 +1,262 @@ | |||
| 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.BootstrapperApplications | ||
| 4 | { | ||
| 5 | using System; | ||
| 6 | using System.IO; | ||
| 7 | using System.Linq; | ||
| 8 | using System.Xml; | ||
| 9 | using WixToolset.BootstrapperApplications; | ||
| 10 | using WixInternal.Core.TestPackage; | ||
| 11 | using WixInternal.TestSupport; | ||
| 12 | using Xunit; | ||
| 13 | |||
| 14 | public class BalExtensionFixture | ||
| 15 | { | ||
| 16 | [Fact] | ||
| 17 | public void CanBuildUsingDisplayInternalUICondition() | ||
| 18 | { | ||
| 19 | using (var fs = new DisposableFileSystem()) | ||
| 20 | { | ||
| 21 | var baseFolder = fs.GetFolder(); | ||
| 22 | var bundleFile = Path.Combine(baseFolder, "bin", "test.exe"); | ||
| 23 | var bundleSourceFolder = TestData.Get(@"TestData\WixStdBa"); | ||
| 24 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
| 25 | var baFolderPath = Path.Combine(baseFolder, "ba"); | ||
| 26 | var extractFolderPath = Path.Combine(baseFolder, "extract"); | ||
| 27 | |||
| 28 | var compileResult = WixRunner.Execute(new[] | ||
| 29 | { | ||
| 30 | "build", | ||
| 31 | Path.Combine(bundleSourceFolder, "DisplayInternalUIConditionBundle.wxs"), | ||
| 32 | "-ext", TestData.Get(@"WixToolset.BootstrapperApplications.wixext.dll"), | ||
| 33 | "-intermediateFolder", intermediateFolder, | ||
| 34 | "-bindpath", Path.Combine(bundleSourceFolder, "data"), | ||
| 35 | "-o", bundleFile, | ||
| 36 | }); | ||
| 37 | compileResult.AssertSuccess(); | ||
| 38 | |||
| 39 | Assert.True(File.Exists(bundleFile)); | ||
| 40 | |||
| 41 | var extractResult = BundleExtractor.ExtractBAContainer(null, bundleFile, baFolderPath, extractFolderPath); | ||
| 42 | extractResult.AssertSuccess(); | ||
| 43 | |||
| 44 | var balPackageInfos = extractResult.GetBADataTestXmlLines("/ba:BootstrapperApplicationData/ba:WixBalPackageInfo"); | ||
| 45 | WixAssert.CompareLineByLine(new string[] | ||
| 46 | { | ||
| 47 | "<WixBalPackageInfo PackageId='test.msi' DisplayInternalUICondition='1' />", | ||
| 48 | }, balPackageInfos); | ||
| 49 | |||
| 50 | Assert.True(File.Exists(Path.Combine(baFolderPath, "thm.wxl"))); | ||
| 51 | } | ||
| 52 | } | ||
| 53 | |||
| 54 | [Fact] | ||
| 55 | public void CanBuildUsingOverridable() | ||
| 56 | { | ||
| 57 | using (var fs = new DisposableFileSystem()) | ||
| 58 | { | ||
| 59 | var baseFolder = fs.GetFolder(); | ||
| 60 | var bundleFile = Path.Combine(baseFolder, "bin", "test.exe"); | ||
| 61 | var bundleSourceFolder = TestData.Get(@"TestData\Overridable"); | ||
| 62 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
| 63 | var baFolderPath = Path.Combine(baseFolder, "ba"); | ||
| 64 | var extractFolderPath = Path.Combine(baseFolder, "extract"); | ||
| 65 | |||
| 66 | var compileResult = WixRunner.Execute(new[] | ||
| 67 | { | ||
| 68 | "build", | ||
| 69 | Path.Combine(bundleSourceFolder, "Bundle.wxs"), | ||
| 70 | "-ext", TestData.Get(@"WixToolset.BootstrapperApplications.wixext.dll"), | ||
| 71 | "-intermediateFolder", intermediateFolder, | ||
| 72 | "-o", bundleFile, | ||
| 73 | }); | ||
| 74 | compileResult.AssertSuccess(); | ||
| 75 | |||
| 76 | Assert.True(File.Exists(bundleFile)); | ||
| 77 | |||
| 78 | var extractResult = BundleExtractor.ExtractBAContainer(null, bundleFile, baFolderPath, extractFolderPath); | ||
| 79 | extractResult.AssertSuccess(); | ||
| 80 | |||
| 81 | var balCommandLines = extractResult.GetBADataTestXmlLines("/ba:BootstrapperApplicationData/ba:WixStdbaCommandLine"); | ||
| 82 | WixAssert.CompareLineByLine(new[] | ||
| 83 | { | ||
| 84 | "<WixStdbaCommandLine VariableType='caseInsensitive' />", | ||
| 85 | }, balCommandLines); | ||
| 86 | |||
| 87 | var balOverridableVariables = extractResult.GetBADataTestXmlLines("/ba:BootstrapperApplicationData/ba:WixStdbaOverridableVariable"); | ||
| 88 | WixAssert.CompareLineByLine(new[] | ||
| 89 | { | ||
| 90 | "<WixStdbaOverridableVariable Name='TEST1' />", | ||
| 91 | }, balOverridableVariables); | ||
| 92 | } | ||
| 93 | } | ||
| 94 | |||
| 95 | [Fact] | ||
| 96 | public void CanBuildUsingWixStdBa() | ||
| 97 | { | ||
| 98 | using (var fs = new DisposableFileSystem()) | ||
| 99 | { | ||
| 100 | var baseFolder = fs.GetFolder(); | ||
| 101 | var bundleFile = Path.Combine(baseFolder, "bin", "test.exe"); | ||
| 102 | var bundleSourceFolder = TestData.Get(@"TestData\WixStdBa"); | ||
| 103 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
| 104 | |||
| 105 | var compileResult = WixRunner.Execute(new[] | ||
| 106 | { | ||
| 107 | "build", | ||
| 108 | Path.Combine(bundleSourceFolder, "Bundle.wxs"), | ||
| 109 | "-ext", TestData.Get(@"WixToolset.BootstrapperApplications.wixext.dll"), | ||
| 110 | "-intermediateFolder", intermediateFolder, | ||
| 111 | "-o", bundleFile, | ||
| 112 | }); | ||
| 113 | compileResult.AssertSuccess(); | ||
| 114 | |||
| 115 | Assert.True(File.Exists(bundleFile)); | ||
| 116 | } | ||
| 117 | } | ||
| 118 | |||
| 119 | //[Fact] | ||
| 120 | //public void CanBuildUsingMBAWithAlwaysInstallPrereqs() | ||
| 121 | //{ | ||
| 122 | // using (var fs = new DisposableFileSystem()) | ||
| 123 | // { | ||
| 124 | // var baseFolder = fs.GetFolder(); | ||
| 125 | // var bundleFile = Path.Combine(baseFolder, "bin", "test.exe"); | ||
| 126 | // var bundleSourceFolder = TestData.Get("TestData", "MBA"); | ||
| 127 | // var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
| 128 | // var baFolderPath = Path.Combine(baseFolder, "ba"); | ||
| 129 | // var extractFolderPath = Path.Combine(baseFolder, "extract"); | ||
| 130 | |||
| 131 | // var compileResult = WixRunner.Execute(new[] | ||
| 132 | // { | ||
| 133 | // "build", | ||
| 134 | // Path.Combine(bundleSourceFolder, "AlwaysInstallPrereqsBundle.wxs"), | ||
| 135 | // "-ext", TestData.Get(@"WixToolset.BootstrapperApplications.wixext.dll"), | ||
| 136 | // "-intermediateFolder", intermediateFolder, | ||
| 137 | // "-o", bundleFile, | ||
| 138 | // }); | ||
| 139 | |||
| 140 | // compileResult.AssertSuccess(); | ||
| 141 | |||
| 142 | // Assert.True(File.Exists(bundleFile)); | ||
| 143 | |||
| 144 | // var extractResult = BundleExtractor.ExtractBAContainer(null, bundleFile, baFolderPath, extractFolderPath); | ||
| 145 | // extractResult.AssertSuccess(); | ||
| 146 | |||
| 147 | // var wixPrereqOptionsElements = extractResult.GetBADataTestXmlLines("/ba:BootstrapperApplicationData/ba:WixPrereqOptions"); | ||
| 148 | // WixAssert.CompareLineByLine(new[] | ||
| 149 | // { | ||
| 150 | // "<WixPrereqOptions AlwaysInstallPrereqs='1' />", | ||
| 151 | // }, wixPrereqOptionsElements); | ||
| 152 | |||
| 153 | // var wixPrereqInformationElements = extractResult.GetBADataTestXmlLines("/ba:BootstrapperApplicationData/ba:WixPrereqInformation"); | ||
| 154 | // WixAssert.CompareLineByLine(new[] | ||
| 155 | // { | ||
| 156 | // "<WixPrereqInformation PackageId='wixnative.exe' />", | ||
| 157 | // }, wixPrereqInformationElements); | ||
| 158 | // } | ||
| 159 | //} | ||
| 160 | |||
| 161 | [Fact] | ||
| 162 | public void CannotBuildUsingMBAWithNoPrereqs() | ||
| 163 | { | ||
| 164 | using (var fs = new DisposableFileSystem()) | ||
| 165 | { | ||
| 166 | var baseFolder = fs.GetFolder(); | ||
| 167 | var bundleFile = Path.Combine(baseFolder, "bin", "test.exe"); | ||
| 168 | var bundleSourceFolder = TestData.Get(@"TestData", "MBA"); | ||
| 169 | var dataFolder = TestData.Get(@"TestData", ".Data"); | ||
| 170 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
| 171 | |||
| 172 | var compileResult = WixRunner.Execute(new[] | ||
| 173 | { | ||
| 174 | "build", | ||
| 175 | Path.Combine(bundleSourceFolder, "Bundle.wxs"), | ||
| 176 | "-ext", TestData.Get(@"WixToolset.BootstrapperApplications.wixext.dll"), | ||
| 177 | "-intermediateFolder", intermediateFolder, | ||
| 178 | "-bindpath", dataFolder, | ||
| 179 | "-o", bundleFile, | ||
| 180 | }); | ||
| 181 | |||
| 182 | WixAssert.CompareLineByLine(new[] | ||
| 183 | { | ||
| 184 | "The WixManagedBootstrapperApplicationHost element has been deprecated.", | ||
| 185 | }, compileResult.Messages.Select(m => m.ToString()).ToArray()); | ||
| 186 | Assert.Equal(1130, compileResult.ExitCode); | ||
| 187 | |||
| 188 | Assert.False(File.Exists(bundleFile)); | ||
| 189 | Assert.False(File.Exists(Path.Combine(intermediateFolder, "test.exe"))); | ||
| 190 | } | ||
| 191 | } | ||
| 192 | |||
| 193 | [Fact] | ||
| 194 | public void CannotBuildUsingDncbaMissingBAFactoryPayload() | ||
| 195 | { | ||
| 196 | using (var fs = new DisposableFileSystem()) | ||
| 197 | { | ||
| 198 | var baseFolder = fs.GetFolder(); | ||
| 199 | var bundleFile = Path.Combine(baseFolder, "bin", "test.exe"); | ||
| 200 | var bundleSourceFolder = TestData.Get(@"TestData\Dncba"); | ||
| 201 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
| 202 | |||
| 203 | var compileResult = WixRunner.Execute(new[] | ||
| 204 | { | ||
| 205 | "build", | ||
| 206 | Path.Combine(bundleSourceFolder, "Bundle.wxs"), | ||
| 207 | "-ext", TestData.Get(@"WixToolset.BootstrapperApplications.wixext.dll"), | ||
| 208 | "-intermediateFolder", intermediateFolder, | ||
| 209 | "-o", bundleFile, | ||
| 210 | }); | ||
| 211 | |||
| 212 | WixAssert.CompareLineByLine(new[] | ||
| 213 | { | ||
| 214 | "The WixDotNetCoreBootstrapperApplicationHost element has been deprecated.", | ||
| 215 | "The BootstrapperApplication element's Name or SourceFile attribute was not found; one of these is required." | ||
| 216 | }, compileResult.Messages.Select(x => x.ToString()).ToArray()); | ||
| 217 | Assert.Equal(44, compileResult.ExitCode); | ||
| 218 | |||
| 219 | Assert.False(File.Exists(bundleFile)); | ||
| 220 | Assert.False(File.Exists(Path.Combine(intermediateFolder, "test.exe"))); | ||
| 221 | } | ||
| 222 | } | ||
| 223 | |||
| 224 | [Fact] | ||
| 225 | public void CannotBuildUsingOverridableWrongCase() | ||
| 226 | { | ||
| 227 | using (var fs = new DisposableFileSystem()) | ||
| 228 | { | ||
| 229 | var baseFolder = fs.GetFolder(); | ||
| 230 | var bundleFile = Path.Combine(baseFolder, "bin", "test.exe"); | ||
| 231 | var bundleSourceFolder = TestData.Get(@"TestData"); | ||
| 232 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
| 233 | var baFolderPath = Path.Combine(baseFolder, "ba"); | ||
| 234 | var extractFolderPath = Path.Combine(baseFolder, "extract"); | ||
| 235 | |||
| 236 | var result = WixRunner.Execute(new[] | ||
| 237 | { | ||
| 238 | "build", | ||
| 239 | Path.Combine(bundleSourceFolder, "Overridable", "WrongCaseBundle.wxs"), | ||
| 240 | "-loc", Path.Combine(bundleSourceFolder, "Overridable", "WrongCaseBundle.wxl"), | ||
| 241 | "-bindpath", Path.Combine(bundleSourceFolder, "WixStdBa", "Data"), | ||
| 242 | "-ext", TestData.Get(@"WixToolset.BootstrapperApplications.wixext.dll"), | ||
| 243 | "-intermediateFolder", intermediateFolder, | ||
| 244 | "-o", bundleFile, | ||
| 245 | }); | ||
| 246 | |||
| 247 | Assert.InRange(result.ExitCode, 2, Int32.MaxValue); | ||
| 248 | |||
| 249 | var messages = result.Messages.Select(m => m.ToString()).ToList(); | ||
| 250 | messages.Sort(); | ||
| 251 | |||
| 252 | WixAssert.CompareLineByLine(new[] | ||
| 253 | { | ||
| 254 | "bal:Condition/@Condition contains the built-in Variable 'WixBundleAction', which is not available when it is evaluated. (Unavailable Variables are: 'WixBundleAction'.). Rewrite the condition to avoid Variables that are never valid during its evaluation.", | ||
| 255 | "Overridable variable 'TEST1' collides with 'Test1' with Bundle/@CommandLineVariables value 'caseInsensitive'.", | ||
| 256 | "The *Package/@bal:DisplayInternalUICondition attribute's value '=' is not a valid bundle condition.", | ||
| 257 | "The location of the Variable related to the previous error.", | ||
| 258 | }, messages.ToArray()); | ||
| 259 | } | ||
| 260 | } | ||
| 261 | } | ||
| 262 | } | ||
