diff options
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/WixToolsetTest.Converters/ConverterFixture.cs | 33 | ||||
-rw-r--r-- | src/test/WixToolsetTest.Converters/RemotePayloadFixture.cs | 104 |
2 files changed, 104 insertions, 33 deletions
diff --git a/src/test/WixToolsetTest.Converters/ConverterFixture.cs b/src/test/WixToolsetTest.Converters/ConverterFixture.cs index 207d5c8f..4d815247 100644 --- a/src/test/WixToolsetTest.Converters/ConverterFixture.cs +++ b/src/test/WixToolsetTest.Converters/ConverterFixture.cs | |||
@@ -331,39 +331,6 @@ namespace WixToolsetTest.Converters | |||
331 | } | 331 | } |
332 | 332 | ||
333 | [Fact] | 333 | [Fact] |
334 | public void CanConvertRemotePayloadElement() | ||
335 | { | ||
336 | var parse = String.Join(Environment.NewLine, | ||
337 | "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>", | ||
338 | " <RemotePayload", | ||
339 | " Description='Microsoft ASP.NET Core 3.1.8 - Shared Framework'", | ||
340 | " Hash='61DC9EAA0C8968E48E13C5913ED202A2F8F94DBA'", | ||
341 | " CertificatePublicKey='3756E9BBF4461DCD0AA68E0D1FCFFA9CEA47AC18'", | ||
342 | " CertificateThumbprint='2485A7AFA98E178CB8F30C9838346B514AEA4769'", | ||
343 | " ProductName='Microsoft ASP.NET Core 3.1.8 - Shared Framework'", | ||
344 | " Size='7841880'", | ||
345 | " Version='3.1.8.20421' />", | ||
346 | "</Wix>"); | ||
347 | |||
348 | var expected = String.Join(Environment.NewLine, | ||
349 | "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", | ||
350 | " <RemotePayload Description=\"Microsoft ASP.NET Core 3.1.8 - Shared Framework\" Hash=\"61DC9EAA0C8968E48E13C5913ED202A2F8F94DBA\" ProductName=\"Microsoft ASP.NET Core 3.1.8 - Shared Framework\" Size=\"7841880\" Version=\"3.1.8.20421\" />", | ||
351 | "</Wix>"); | ||
352 | |||
353 | var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); | ||
354 | |||
355 | var messaging = new MockMessaging(); | ||
356 | var converter = new WixConverter(messaging, 2, null, null); | ||
357 | |||
358 | var errors = converter.ConvertDocument(document); | ||
359 | |||
360 | var actual = UnformattedDocumentString(document); | ||
361 | |||
362 | Assert.Equal(2, errors); | ||
363 | Assert.Equal(expected, actual); | ||
364 | } | ||
365 | |||
366 | [Fact] | ||
367 | public void CanConvertSuppressSignatureValidationNo() | 334 | public void CanConvertSuppressSignatureValidationNo() |
368 | { | 335 | { |
369 | var parse = String.Join(Environment.NewLine, | 336 | var parse = String.Join(Environment.NewLine, |
diff --git a/src/test/WixToolsetTest.Converters/RemotePayloadFixture.cs b/src/test/WixToolsetTest.Converters/RemotePayloadFixture.cs new file mode 100644 index 00000000..b2640e13 --- /dev/null +++ b/src/test/WixToolsetTest.Converters/RemotePayloadFixture.cs | |||
@@ -0,0 +1,104 @@ | |||
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.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 RemotePayloadFixture : BaseConverterFixture | ||
13 | { | ||
14 | [Fact] | ||
15 | public void CanConvertExePackageRemotePayload() | ||
16 | { | ||
17 | var parse = String.Join(Environment.NewLine, | ||
18 | "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>", | ||
19 | " <Fragment>", | ||
20 | " <PackageGroup Id='exe'>", | ||
21 | " <ExePackage Name='example.exe' DownloadUrl='example.com'>", | ||
22 | " <RemotePayload", | ||
23 | " Description='Microsoft ASP.NET Core 3.1.8 - Shared Framework'", | ||
24 | " Hash='61DC9EAA0C8968E48E13C5913ED202A2F8F94DBA'", | ||
25 | " CertificatePublicKey='3756E9BBF4461DCD0AA68E0D1FCFFA9CEA47AC18'", | ||
26 | " CertificateThumbprint='2485A7AFA98E178CB8F30C9838346B514AEA4769'", | ||
27 | " ProductName='Microsoft ASP.NET Core 3.1.8 - Shared Framework'", | ||
28 | " Size='7841880'", | ||
29 | " Version='3.1.8.20421' />", | ||
30 | " </ExePackage>", | ||
31 | " </PackageGroup>", | ||
32 | " </Fragment>", | ||
33 | "</Wix>"); | ||
34 | |||
35 | var expected = new[] | ||
36 | { | ||
37 | "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", | ||
38 | " <Fragment>", | ||
39 | " <PackageGroup Id=\"exe\">", | ||
40 | " <ExePackage>", | ||
41 | " <ExePackagePayload Description=\"Microsoft ASP.NET Core 3.1.8 - Shared Framework\" Hash=\"61DC9EAA0C8968E48E13C5913ED202A2F8F94DBA\" ProductName=\"Microsoft ASP.NET Core 3.1.8 - Shared Framework\" Size=\"7841880\" Version=\"3.1.8.20421\" Name=\"example.exe\" DownloadUrl=\"example.com\" />", | ||
42 | " </ExePackage>", | ||
43 | " </PackageGroup>", | ||
44 | " </Fragment>", | ||
45 | "</Wix>" | ||
46 | }; | ||
47 | |||
48 | var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); | ||
49 | |||
50 | var messaging = new MockMessaging(); | ||
51 | var converter = new WixConverter(messaging, 2, null, null); | ||
52 | |||
53 | var errors = converter.ConvertDocument(document); | ||
54 | Assert.Equal(6, errors); | ||
55 | |||
56 | var actualLines = UnformattedDocumentLines(document); | ||
57 | WixAssert.CompareLineByLine(expected, actualLines); | ||
58 | } | ||
59 | |||
60 | [Fact] | ||
61 | public void CanConvertMsuPackageRemotePayload() | ||
62 | { | ||
63 | var parse = String.Join(Environment.NewLine, | ||
64 | "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>", | ||
65 | " <Fragment>", | ||
66 | " <PackageGroup Id='msu'>", | ||
67 | " <MsuPackage Name='example.msu' DownloadUrl='example.com' Compressed='no'>", | ||
68 | " <RemotePayload", | ||
69 | " Description='msu description'", | ||
70 | " Hash='71DC9EAA0C8968E48E13C5913ED202A2F8F94DBB'", | ||
71 | " ProductName='msu product name'", | ||
72 | " Size='500'", | ||
73 | " Version='0.0.0.0' />", | ||
74 | " </MsuPackage>", | ||
75 | " </PackageGroup>", | ||
76 | " </Fragment>", | ||
77 | "</Wix>"); | ||
78 | |||
79 | var expected = new[] | ||
80 | { | ||
81 | "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", | ||
82 | " <Fragment>", | ||
83 | " <PackageGroup Id=\"msu\">", | ||
84 | " <MsuPackage>", | ||
85 | " <MsuPackagePayload Description=\"msu description\" Hash=\"71DC9EAA0C8968E48E13C5913ED202A2F8F94DBB\" ProductName=\"msu product name\" Size=\"500\" Version=\"0.0.0.0\" Name=\"example.msu\" DownloadUrl=\"example.com\" />", | ||
86 | " </MsuPackage>", | ||
87 | " </PackageGroup>", | ||
88 | " </Fragment>", | ||
89 | "</Wix>" | ||
90 | }; | ||
91 | |||
92 | var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); | ||
93 | |||
94 | var messaging = new MockMessaging(); | ||
95 | var converter = new WixConverter(messaging, 2, null, null); | ||
96 | |||
97 | var errors = converter.ConvertDocument(document); | ||
98 | Assert.Equal(5, errors); | ||
99 | |||
100 | var actualLines = UnformattedDocumentLines(document); | ||
101 | WixAssert.CompareLineByLine(expected, actualLines); | ||
102 | } | ||
103 | } | ||
104 | } | ||