aboutsummaryrefslogtreecommitdiff
path: root/src/test/WixToolsetTest.Converters/BootstrapperApplicationFixture.cs
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2021-04-27 22:37:33 -0700
committerRob Mensching <rob@firegiant.com>2021-04-27 22:37:33 -0700
commit612dc390ecd90bf4079ad7545f4a4832ce8f702d (patch)
treed027ac1e327ef78c83b722ab28e293a6bbeb7a78 /src/test/WixToolsetTest.Converters/BootstrapperApplicationFixture.cs
parent0177cb5b9b08351266816097ea9e8561b9ec0973 (diff)
downloadwix-612dc390ecd90bf4079ad7545f4a4832ce8f702d.tar.gz
wix-612dc390ecd90bf4079ad7545f4a4832ce8f702d.tar.bz2
wix-612dc390ecd90bf4079ad7545f4a4832ce8f702d.zip
Move Converters into wix
Diffstat (limited to 'src/test/WixToolsetTest.Converters/BootstrapperApplicationFixture.cs')
-rw-r--r--src/test/WixToolsetTest.Converters/BootstrapperApplicationFixture.cs418
1 files changed, 0 insertions, 418 deletions
diff --git a/src/test/WixToolsetTest.Converters/BootstrapperApplicationFixture.cs b/src/test/WixToolsetTest.Converters/BootstrapperApplicationFixture.cs
deleted file mode 100644
index 158ab3be..00000000
--- a/src/test/WixToolsetTest.Converters/BootstrapperApplicationFixture.cs
+++ /dev/null
@@ -1,418 +0,0 @@
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
3namespace WixToolsetTest.Converters
4{
5 using System;
6 using System.Xml.Linq;
7 using WixBuildTools.TestSupport;
8 using WixToolset.Converters;
9 using WixToolsetTest.Converters.Mocks;
10 using Xunit;
11
12 public class BootstrapperApplicationFixture : BaseConverterFixture
13 {
14 [Fact]
15 public void CantCreateBootstrapperApplicationDllFromV3PayloadGroupRef()
16 {
17 var parse = String.Join(Environment.NewLine,
18 "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>",
19 " <Fragment>",
20 " <BootstrapperApplication Id='ba'>",
21 " <PayloadGroupRef Id='baPayloads' />",
22 " </BootstrapperApplication>",
23 " </Fragment>",
24 "</Wix>");
25
26 var expected = new[]
27 {
28 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
29 " <Fragment>",
30 " <BootstrapperApplication Id=\"ba\">",
31 " <PayloadGroupRef Id=\"baPayloads\" />",
32 " </BootstrapperApplication>",
33 " </Fragment>",
34 "</Wix>"
35 };
36
37 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
38
39 var messaging = new MockMessaging();
40 var converter = new WixConverter(messaging, 2, null, null);
41
42 var errors = converter.ConvertDocument(document);
43 Assert.Equal(2, errors);
44
45 var actualLines = UnformattedDocumentLines(document);
46 WixAssert.CompareLineByLine(expected, actualLines);
47 }
48
49 [Fact]
50 public void ConvertDotNetCoreBootstrapperApplicationRefWithExistingElement()
51 {
52 var parse = String.Join(Environment.NewLine,
53 "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs' xmlns:bal='http://wixtoolset.org/schemas/v4/wxs/bal'>",
54 " <Fragment>",
55 " <BootstrapperApplicationRef Id='DotNetCoreBootstrapperApplicationHost.Minimal'>",
56 " <bal:WixDotNetCoreBootstrapperApplication SelfContainedDeployment='yes' />",
57 " </BootstrapperApplicationRef>",
58 " </Fragment>",
59 "</Wix>");
60
61 var expected = new[]
62 {
63 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\" xmlns:bal=\"http://wixtoolset.org/schemas/v4/wxs/bal\">",
64 " <Fragment>",
65 " <BootstrapperApplication>",
66 " <bal:WixDotNetCoreBootstrapperApplicationHost SelfContainedDeployment=\"yes\" Theme=\"none\" />",
67 " </BootstrapperApplication>",
68 " </Fragment>",
69 "</Wix>"
70 };
71
72 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
73
74 var messaging = new MockMessaging();
75 var converter = new WixConverter(messaging, 2, null, null);
76
77 var errors = converter.ConvertDocument(document);
78 Assert.Equal(1, errors);
79
80 var actualLines = UnformattedDocumentLines(document);
81 WixAssert.CompareLineByLine(expected, actualLines);
82 }
83
84 [Fact]
85 public void ConvertDotNetCoreBootstrapperApplicationRefWithoutExistingElement()
86 {
87 var parse = String.Join(Environment.NewLine,
88 "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs' xmlns:bal='http://wixtoolset.org/schemas/v4/wxs/bal'>",
89 " <Fragment>",
90 " <BootstrapperApplicationRef Id='DotNetCoreBootstrapperApplicationHost' />",
91 " </Fragment>",
92 "</Wix>");
93
94 var expected = new[]
95 {
96 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\" xmlns:bal=\"http://wixtoolset.org/schemas/v4/wxs/bal\">",
97 " <Fragment>",
98 " <BootstrapperApplication>",
99 "<bal:WixDotNetCoreBootstrapperApplicationHost />",
100 "</BootstrapperApplication>",
101 " </Fragment>",
102 "</Wix>"
103 };
104
105 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
106
107 var messaging = new MockMessaging();
108 var converter = new WixConverter(messaging, 2, null, null);
109
110 var errors = converter.ConvertDocument(document);
111 Assert.Equal(1, errors);
112
113 var actualLines = UnformattedDocumentLines(document);
114 WixAssert.CompareLineByLine(expected, actualLines);
115 }
116
117 [Fact]
118 public void ConvertFrameworkBootstrapperApplicationRefWithExistingElement()
119 {
120 var parse = String.Join(Environment.NewLine,
121 "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:bal='http://schemas.microsoft.com/wix/BalExtension'>",
122 " <Fragment>",
123 " <BootstrapperApplicationRef Id='ManagedBootstrapperApplicationHost'>",
124 " <bal:WixManagedBootstrapperApplicationHost LogoFile='logo.png' />",
125 " </BootstrapperApplicationRef>",
126 " </Fragment>",
127 "</Wix>");
128
129 var expected = new[]
130 {
131 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\" xmlns:bal=\"http://wixtoolset.org/schemas/v4/wxs/bal\">",
132 " <Fragment>",
133 " <BootstrapperApplication>",
134 " <bal:WixManagedBootstrapperApplicationHost LogoFile=\"logo.png\" />",
135 " </BootstrapperApplication>",
136 " </Fragment>",
137 "</Wix>"
138 };
139
140 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
141
142 var messaging = new MockMessaging();
143 var converter = new WixConverter(messaging, 2, null, null);
144
145 var errors = converter.ConvertDocument(document);
146 Assert.Equal(3, errors);
147
148 var actualLines = UnformattedDocumentLines(document);
149 WixAssert.CompareLineByLine(expected, actualLines);
150 }
151
152 [Fact]
153 public void ConvertFrameworkBootstrapperApplicationRefWithoutExistingElement()
154 {
155 var parse = String.Join(Environment.NewLine,
156 "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:bal='http://schemas.microsoft.com/wix/BalExtension'>",
157 " <Fragment>",
158 " <BootstrapperApplicationRef Id='ManagedBootstrapperApplicationHost.RtfLicense.Minimal' />",
159 " </Fragment>",
160 "</Wix>");
161
162 var expected = new[]
163 {
164 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\" xmlns:bal=\"http://wixtoolset.org/schemas/v4/wxs/bal\">",
165 " <Fragment>",
166 " <BootstrapperApplication>",
167 "<bal:WixManagedBootstrapperApplicationHost Theme=\"none\" />",
168 "</BootstrapperApplication>",
169 " </Fragment>",
170 "</Wix>"
171 };
172
173 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
174
175 var messaging = new MockMessaging();
176 var converter = new WixConverter(messaging, 2, null, null);
177
178 var errors = converter.ConvertDocument(document);
179 Assert.Equal(3, errors);
180
181 var actualLines = UnformattedDocumentLines(document);
182 WixAssert.CompareLineByLine(expected, actualLines);
183 }
184
185 [Fact]
186 public void ConvertStandardBootstrapperApplicationRefWithExistingElement()
187 {
188 var parse = String.Join(Environment.NewLine,
189 "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:bal='http://schemas.microsoft.com/wix/BalExtension'>",
190 " <Fragment>",
191 " <BootstrapperApplicationRef Id='WixStandardBootstrapperApplication.Foundation'>",
192 " <bal:WixStandardBootstrapperApplication LaunchTarget='[InstallFolder]the.exe' />",
193 " </BootstrapperApplicationRef>",
194 " </Fragment>",
195 "</Wix>");
196
197 var expected = new[]
198 {
199 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\" xmlns:bal=\"http://wixtoolset.org/schemas/v4/wxs/bal\">",
200 " <Fragment>",
201 " <BootstrapperApplication>",
202 " <bal:WixStandardBootstrapperApplication LaunchTarget=\"[InstallFolder]the.exe\" Theme=\"none\" />",
203 " </BootstrapperApplication>",
204 " </Fragment>",
205 "</Wix>"
206 };
207
208 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
209
210 var messaging = new MockMessaging();
211 var converter = new WixConverter(messaging, 2, null, null);
212
213 var errors = converter.ConvertDocument(document);
214 Assert.Equal(3, errors);
215
216 var actualLines = UnformattedDocumentLines(document);
217 WixAssert.CompareLineByLine(expected, actualLines);
218 }
219
220 [Fact]
221 public void ConvertStandardBootstrapperApplicationRefWithoutExistingElement()
222 {
223 var parse = String.Join(Environment.NewLine,
224 "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:bal='http://schemas.microsoft.com/wix/BalExtension'>",
225 " <Fragment>",
226 " <BootstrapperApplicationRef Id='WixStandardBootstrapperApplication.RtfLicense' />",
227 " </Fragment>",
228 "</Wix>");
229
230 var expected = new[]
231 {
232 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\" xmlns:bal=\"http://wixtoolset.org/schemas/v4/wxs/bal\">",
233 " <Fragment>",
234 " <BootstrapperApplication>",
235 "<bal:WixStandardBootstrapperApplication Theme=\"rtfLicense\" />",
236 "</BootstrapperApplication>",
237 " </Fragment>",
238 "</Wix>"
239 };
240
241 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
242
243 var messaging = new MockMessaging();
244 var converter = new WixConverter(messaging, 2, null, null);
245
246 var errors = converter.ConvertDocument(document);
247 Assert.Equal(3, errors);
248
249 var actualLines = UnformattedDocumentLines(document);
250 WixAssert.CompareLineByLine(expected, actualLines);
251 }
252
253 [Fact]
254 public void CreateBootstrapperApplicationDllFromV3()
255 {
256 var parse = String.Join(Environment.NewLine,
257 "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>",
258 " <Fragment>",
259 " <BootstrapperApplication Id='ba' SourceFile='ba.dll' />",
260 " </Fragment>",
261 "</Wix>");
262
263 var expected = new[]
264 {
265 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
266 " <Fragment>",
267 " <BootstrapperApplication Id=\"ba\">",
268 "<BootstrapperApplicationDll SourceFile=\"ba.dll\" DpiAwareness=\"unaware\" />",
269 "</BootstrapperApplication>",
270 " </Fragment>",
271 "</Wix>"
272 };
273
274 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
275
276 var messaging = new MockMessaging();
277 var converter = new WixConverter(messaging, 2, null, null);
278
279 var errors = converter.ConvertDocument(document);
280 Assert.Equal(3, errors);
281
282 var actualLines = UnformattedDocumentLines(document);
283 WixAssert.CompareLineByLine(expected, actualLines);
284 }
285
286 [Fact]
287 public void CreateBootstrapperApplicationDllFromV3Payload()
288 {
289 var parse = String.Join(Environment.NewLine,
290 "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>",
291 " <Fragment>",
292 " <BootstrapperApplication Id='ba'>",
293 " <Payload SourceFile='ba.dll' />",
294 " </BootstrapperApplication>",
295 " </Fragment>",
296 "</Wix>");
297
298 var expected = new[]
299 {
300 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
301 " <Fragment>",
302 " <BootstrapperApplication Id=\"ba\">",
303 " ",
304 " ",
305 "<BootstrapperApplicationDll SourceFile=\"ba.dll\" DpiAwareness=\"unaware\" />",
306 "</BootstrapperApplication>",
307 " </Fragment>",
308 "</Wix>"
309 };
310
311 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
312
313 var messaging = new MockMessaging();
314 var converter = new WixConverter(messaging, 2, null, null);
315
316 var errors = converter.ConvertDocument(document);
317 Assert.Equal(3, errors);
318
319 var actualLines = UnformattedDocumentLines(document);
320 WixAssert.CompareLineByLine(expected, actualLines);
321 }
322
323 [Fact]
324 public void DoesntSetDpiUnawareFromV4()
325 {
326 var parse = String.Join(Environment.NewLine,
327 "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>",
328 " <Fragment>",
329 " <BootstrapperApplication Id='ba' />",
330 " </Fragment>",
331 "</Wix>");
332
333 var expected = new[]
334 {
335 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
336 " <Fragment>",
337 " <BootstrapperApplication Id=\"ba\" />",
338 " </Fragment>",
339 "</Wix>"
340 };
341
342 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
343
344 var messaging = new MockMessaging();
345 var converter = new WixConverter(messaging, 2, null, null);
346
347 var errors = converter.ConvertDocument(document);
348 Assert.Equal(0, errors);
349
350 var actualLines = UnformattedDocumentLines(document);
351 WixAssert.CompareLineByLine(expected, actualLines);
352 }
353
354 [Fact]
355 public void KeepsDpiAwarenessFromV4()
356 {
357 var parse = String.Join(Environment.NewLine,
358 "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>",
359 " <Fragment>",
360 " <BootstrapperApplication Id='ba' SourceFile='ba.dll' DpiAwareness='system' />",
361 " </Fragment>",
362 "</Wix>");
363
364 var expected = new[]
365 {
366 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
367 " <Fragment>",
368 " <BootstrapperApplication Id=\"ba\">",
369 "<BootstrapperApplicationDll SourceFile=\"ba.dll\" DpiAwareness=\"system\" />",
370 "</BootstrapperApplication>",
371 " </Fragment>",
372 "</Wix>"
373 };
374
375 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
376
377 var messaging = new MockMessaging();
378 var converter = new WixConverter(messaging, 2, null, null);
379
380 var errors = converter.ConvertDocument(document);
381 Assert.Equal(1, errors);
382
383 var actualLines = UnformattedDocumentLines(document);
384 WixAssert.CompareLineByLine(expected, actualLines);
385 }
386
387 [Fact]
388 public void RemovesBalUseUILanguages()
389 {
390 var parse = String.Join(Environment.NewLine,
391 "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:bal='http://schemas.microsoft.com/wix/BalExtension'>",
392 " <Fragment>",
393 " <BootstrapperApplication Id='ba' bal:UseUILanguages='true' />",
394 " </Fragment>",
395 "</Wix>");
396
397 var expected = new[]
398 {
399 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
400 " <Fragment>",
401 " <BootstrapperApplication Id=\"ba\" />",
402 " </Fragment>",
403 "</Wix>"
404 };
405
406 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
407
408 var messaging = new MockMessaging();
409 var converter = new WixConverter(messaging, 2, null, null);
410
411 var errors = converter.ConvertDocument(document);
412 Assert.Equal(5, errors);
413
414 var actualLines = UnformattedDocumentLines(document);
415 WixAssert.CompareLineByLine(expected, actualLines);
416 }
417 }
418}