main
cs 58 lines 2.18 KB
Raw
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.Linq;
7 using System.Xml.Linq;
8 using WixInternal.TestSupport;
9 using WixToolset.Converters;
10 using WixToolsetTest.Converters.Mocks;
11 using Xunit;
12
13 public class MsiPackageFixture : BaseConverterFixture
14 {
15 [Fact]
16 public void CanRemoveSuppressSignatureVerificationAttributes()
17 {
18 var parse = String.Join(Environment.NewLine,
19 "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>",
20 " <Fragment>",
21 " <PackageGroup Id='msi'>",
22 " <MsiPackage Id='MsiPackage1' SuppressSignatureVerification='yes'>",
23 " </MsiPackage>",
24 " </PackageGroup>",
25 " </Fragment>",
26 "</Wix>");
27
28 var expected = new[]
29 {
30 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
31 " <Fragment>",
32 " <PackageGroup Id=\"msi\">",
33 " <MsiPackage Id=\"MsiPackage1\">",
34 " </MsiPackage>",
35 " </PackageGroup>",
36 " </Fragment>",
37 "</Wix>"
38 };
39
40 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
41
42 var messaging = new MockMessaging();
43 var converter = new WixConverter(messaging, 2, null, null);
44
45 var errors = converter.ConvertDocument(document);
46
47 var actualLines = UnformattedDocumentLines(document);
48 WixAssert.CompareLineByLine(expected, actualLines);
49
50 WixAssert.CompareLineByLine(new[]
51 {
52 "[Converted] The chain package element contains obsolete 'SuppressSignatureVerification' attribute. The attribute will be removed. (SuppressSignatureVerificationObsolete)",
53 }, messaging.Messages.Select(m => m.ToString()).ToArray());
54
55 Assert.Equal(1, errors);
56 }
57 }
58 }