diff options
Diffstat (limited to 'src/test/WixToolsetTest.Converters/PropertyFixture.cs')
-rw-r--r-- | src/test/WixToolsetTest.Converters/PropertyFixture.cs | 108 |
1 files changed, 0 insertions, 108 deletions
diff --git a/src/test/WixToolsetTest.Converters/PropertyFixture.cs b/src/test/WixToolsetTest.Converters/PropertyFixture.cs deleted file mode 100644 index e50a6518..00000000 --- a/src/test/WixToolsetTest.Converters/PropertyFixture.cs +++ /dev/null | |||
@@ -1,108 +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 | |||
3 | namespace WixToolsetTest.Converters | ||
4 | { | ||
5 | using System; | ||
6 | using System.Xml.Linq; | ||
7 | using WixToolset.Converters; | ||
8 | using WixToolsetTest.Converters.Mocks; | ||
9 | using Xunit; | ||
10 | |||
11 | public class PropertyFixture : BaseConverterFixture | ||
12 | { | ||
13 | [Fact] | ||
14 | public void CanFixCdataWhitespace() | ||
15 | { | ||
16 | var parse = String.Join(Environment.NewLine, | ||
17 | "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>", | ||
18 | " <Fragment>", | ||
19 | " <Property Id='Prop'>", | ||
20 | " <![CDATA[1<2]]>", | ||
21 | " </Property>", | ||
22 | " </Fragment>", | ||
23 | "</Wix>"); | ||
24 | |||
25 | var expected = String.Join(Environment.NewLine, | ||
26 | "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", | ||
27 | " <Fragment>", | ||
28 | " <Property Id=\"Prop\" Value=\"1<2\" />", | ||
29 | " </Fragment>", | ||
30 | "</Wix>"); | ||
31 | |||
32 | var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); | ||
33 | |||
34 | var messaging = new MockMessaging(); | ||
35 | var converter = new WixConverter(messaging, 2, null, null); | ||
36 | |||
37 | var errors = converter.ConvertDocument(document); | ||
38 | |||
39 | var actual = UnformattedDocumentString(document); | ||
40 | |||
41 | Assert.Equal(expected, actual); | ||
42 | Assert.Equal(1, errors); | ||
43 | } | ||
44 | |||
45 | [Fact] | ||
46 | public void CanFixCdataWithWhitespace() | ||
47 | { | ||
48 | var parse = String.Join(Environment.NewLine, | ||
49 | "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>", | ||
50 | " <Fragment>", | ||
51 | " <Property Id='Prop'>", | ||
52 | " <![CDATA[", | ||
53 | " 1<2", | ||
54 | " ]]>", | ||
55 | " </Property>", | ||
56 | " </Fragment>", | ||
57 | "</Wix>"); | ||
58 | |||
59 | var expected = String.Join(Environment.NewLine, | ||
60 | "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", | ||
61 | " <Fragment>", | ||
62 | " <Property Id=\"Prop\" Value=\"1<2\" />", | ||
63 | " </Fragment>", | ||
64 | "</Wix>"); | ||
65 | |||
66 | var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); | ||
67 | |||
68 | var messaging = new MockMessaging(); | ||
69 | var converter = new WixConverter(messaging, 2, null, null); | ||
70 | |||
71 | var errors = converter.ConvertDocument(document); | ||
72 | |||
73 | var actual = UnformattedDocumentString(document); | ||
74 | |||
75 | Assert.Equal(expected, actual); | ||
76 | Assert.Equal(1, errors); | ||
77 | } | ||
78 | |||
79 | [Fact] | ||
80 | public void CanKeepCdataWithOnlyWhitespace() | ||
81 | { | ||
82 | var parse = String.Join(Environment.NewLine, | ||
83 | "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>", | ||
84 | " <Fragment>", | ||
85 | " <Property Id='Prop'><![CDATA[ ]]></Property>", | ||
86 | " </Fragment>", | ||
87 | "</Wix>"); | ||
88 | |||
89 | var expected = String.Join(Environment.NewLine, | ||
90 | "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", | ||
91 | " <Fragment>", | ||
92 | " <Property Id=\"Prop\" Value=\" \" />", | ||
93 | " </Fragment>", | ||
94 | "</Wix>"); | ||
95 | |||
96 | var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); | ||
97 | |||
98 | var messaging = new MockMessaging(); | ||
99 | var converter = new WixConverter(messaging, 2, null, null); | ||
100 | var errors = converter.ConvertDocument(document); | ||
101 | |||
102 | var actual = UnformattedDocumentString(document); | ||
103 | |||
104 | Assert.Equal(expected, actual); | ||
105 | Assert.Equal(1, errors); | ||
106 | } | ||
107 | } | ||
108 | } | ||