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