diff options
Diffstat (limited to 'src/test/WixToolsetTest.Converters/ExtensionFixture.cs')
-rw-r--r-- | src/test/WixToolsetTest.Converters/ExtensionFixture.cs | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/src/test/WixToolsetTest.Converters/ExtensionFixture.cs b/src/test/WixToolsetTest.Converters/ExtensionFixture.cs new file mode 100644 index 00000000..4bf2ed3d --- /dev/null +++ b/src/test/WixToolsetTest.Converters/ExtensionFixture.cs | |||
@@ -0,0 +1,80 @@ | |||
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 ExtensionFixture : BaseConverterFixture | ||
13 | { | ||
14 | [Fact] | ||
15 | public void FixRemoteAddressValue() | ||
16 | { | ||
17 | var parse = String.Join(Environment.NewLine, | ||
18 | "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:fw='http://schemas.microsoft.com/wix/FirewallExtension'>", | ||
19 | " <Fragment>", | ||
20 | " <fw:RemoteAddress>", | ||
21 | " 127.0.0.1", | ||
22 | " </fw:RemoteAddress>", | ||
23 | " </Fragment>", | ||
24 | "</Wix>"); | ||
25 | |||
26 | var expected = new[] | ||
27 | { | ||
28 | "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\" xmlns:fw=\"http://wixtoolset.org/schemas/v4/wxs/firewall\">", | ||
29 | " <Fragment>", | ||
30 | " <fw:RemoteAddress Value=\"127.0.0.1\" />", | ||
31 | " </Fragment>", | ||
32 | "</Wix>" | ||
33 | }; | ||
34 | |||
35 | var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); | ||
36 | |||
37 | var messaging = new MockMessaging(); | ||
38 | var converter = new WixConverter(messaging, 2, null, null); | ||
39 | |||
40 | var errors = converter.ConvertDocument(document); | ||
41 | Assert.Equal(3, errors); | ||
42 | |||
43 | var actualLines = UnformattedDocumentLines(document); | ||
44 | WixAssert.CompareLineByLine(expected, actualLines); | ||
45 | } | ||
46 | |||
47 | [Fact] | ||
48 | public void FixXmlConfigValue() | ||
49 | { | ||
50 | var parse = String.Join(Environment.NewLine, | ||
51 | "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:util='http://schemas.microsoft.com/wix/UtilExtension'>", | ||
52 | " <Fragment>", | ||
53 | " <util:XmlConfig Id='Change' ElementPath='book'>", | ||
54 | " a<>b", | ||
55 | " </util:XmlConfig>", | ||
56 | " </Fragment>", | ||
57 | "</Wix>"); | ||
58 | |||
59 | var expected = new[] | ||
60 | { | ||
61 | "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\" xmlns:util=\"http://wixtoolset.org/schemas/v4/wxs/util\">", | ||
62 | " <Fragment>", | ||
63 | " <util:XmlConfig Id=\"Change\" ElementPath=\"book\" Value=\"a<>b\" />", | ||
64 | " </Fragment>", | ||
65 | "</Wix>" | ||
66 | }; | ||
67 | |||
68 | var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); | ||
69 | |||
70 | var messaging = new MockMessaging(); | ||
71 | var converter = new WixConverter(messaging, 2, null, null); | ||
72 | |||
73 | var errors = converter.ConvertDocument(document); | ||
74 | Assert.Equal(3, errors); | ||
75 | |||
76 | var actualLines = UnformattedDocumentLines(document); | ||
77 | WixAssert.CompareLineByLine(expected, actualLines); | ||
78 | } | ||
79 | } | ||
80 | } | ||