diff options
Diffstat (limited to 'src/test')
3 files changed, 182 insertions, 4 deletions
diff --git a/src/test/WixToolsetTest.Converters/BootstrapperApplicationFixture.cs b/src/test/WixToolsetTest.Converters/BootstrapperApplicationFixture.cs index 60386470..158ab3be 100644 --- a/src/test/WixToolsetTest.Converters/BootstrapperApplicationFixture.cs +++ b/src/test/WixToolsetTest.Converters/BootstrapperApplicationFixture.cs | |||
@@ -396,7 +396,7 @@ namespace WixToolsetTest.Converters | |||
396 | 396 | ||
397 | var expected = new[] | 397 | var expected = new[] |
398 | { | 398 | { |
399 | "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\" xmlns:bal=\"http://wixtoolset.org/schemas/v4/wxs/bal\">", | 399 | "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", |
400 | " <Fragment>", | 400 | " <Fragment>", |
401 | " <BootstrapperApplication Id=\"ba\" />", | 401 | " <BootstrapperApplication Id=\"ba\" />", |
402 | " </Fragment>", | 402 | " </Fragment>", |
@@ -409,7 +409,7 @@ namespace WixToolsetTest.Converters | |||
409 | var converter = new WixConverter(messaging, 2, null, null); | 409 | var converter = new WixConverter(messaging, 2, null, null); |
410 | 410 | ||
411 | var errors = converter.ConvertDocument(document); | 411 | var errors = converter.ConvertDocument(document); |
412 | Assert.Equal(4, errors); | 412 | Assert.Equal(5, errors); |
413 | 413 | ||
414 | var actualLines = UnformattedDocumentLines(document); | 414 | var actualLines = UnformattedDocumentLines(document); |
415 | WixAssert.CompareLineByLine(expected, actualLines); | 415 | WixAssert.CompareLineByLine(expected, actualLines); |
diff --git a/src/test/WixToolsetTest.Converters/ConverterFixture.cs b/src/test/WixToolsetTest.Converters/ConverterFixture.cs index 20f42068..207d5c8f 100644 --- a/src/test/WixToolsetTest.Converters/ConverterFixture.cs +++ b/src/test/WixToolsetTest.Converters/ConverterFixture.cs | |||
@@ -166,7 +166,7 @@ namespace WixToolsetTest.Converters | |||
166 | "</Wix>"); | 166 | "</Wix>"); |
167 | 167 | ||
168 | var expected = String.Join(Environment.NewLine, | 168 | var expected = String.Join(Environment.NewLine, |
169 | "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\" xmlns:util=\"http://wixtoolset.org/schemas/v4/wxs/util\">", | 169 | "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", |
170 | " <Fragment />", | 170 | " <Fragment />", |
171 | "</Wix>"); | 171 | "</Wix>"); |
172 | 172 | ||
@@ -179,7 +179,7 @@ namespace WixToolsetTest.Converters | |||
179 | 179 | ||
180 | var actual = UnformattedDocumentString(document); | 180 | var actual = UnformattedDocumentString(document); |
181 | 181 | ||
182 | Assert.Equal(3, errors); | 182 | Assert.Equal(4, errors); |
183 | Assert.Equal(expected, actual); | 183 | Assert.Equal(expected, actual); |
184 | Assert.Equal(Wix4Namespace, document.Root.GetDefaultNamespace()); | 184 | Assert.Equal(Wix4Namespace, document.Root.GetDefaultNamespace()); |
185 | } | 185 | } |
diff --git a/src/test/WixToolsetTest.Converters/DependencyFixture.cs b/src/test/WixToolsetTest.Converters/DependencyFixture.cs new file mode 100644 index 00000000..41ded927 --- /dev/null +++ b/src/test/WixToolsetTest.Converters/DependencyFixture.cs | |||
@@ -0,0 +1,178 @@ | |||
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 DependencyFixture : BaseConverterFixture | ||
13 | { | ||
14 | [Fact] | ||
15 | public void FixPackageDependencyProvides() | ||
16 | { | ||
17 | var parse = String.Join(Environment.NewLine, | ||
18 | "<?xml version=\"1.0\" encoding=\"utf-16\"?>", | ||
19 | "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:dep='http://schemas.microsoft.com/wix/DependencyExtension'>", | ||
20 | " <Fragment>", | ||
21 | " <ComponentGroup Id='Group1' Directory='INSTALLFOLDER'>", | ||
22 | " <Component>", | ||
23 | " <dep:Provides Key='abc' />", | ||
24 | " </Component>", | ||
25 | " </ComponentGroup>", | ||
26 | " </Fragment>", | ||
27 | "</Wix>"); | ||
28 | |||
29 | var expected = new[] | ||
30 | { | ||
31 | "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\" xmlns:dep=\"http://wixtoolset.org/schemas/v4/wxs/dependency\">", | ||
32 | " <Fragment>", | ||
33 | " <ComponentGroup Id=\"Group1\" Directory=\"INSTALLFOLDER\">", | ||
34 | " <Component>", | ||
35 | " <Provides Key=\"abc\" dep:Check=\"yes\" />", | ||
36 | " </Component>", | ||
37 | " </ComponentGroup>", | ||
38 | " </Fragment>", | ||
39 | "</Wix>" | ||
40 | }; | ||
41 | |||
42 | var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); | ||
43 | |||
44 | var messaging = new MockMessaging(); | ||
45 | var converter = new WixConverter(messaging, 2, null, null); | ||
46 | |||
47 | var errors = converter.ConvertDocument(document); | ||
48 | Assert.Equal(5, errors); | ||
49 | |||
50 | var actualLines = UnformattedDocumentLines(document); | ||
51 | WixAssert.CompareLineByLine(expected, actualLines); | ||
52 | } | ||
53 | |||
54 | [Fact] | ||
55 | public void FixPackageDependencyRequires() | ||
56 | { | ||
57 | var parse = String.Join(Environment.NewLine, | ||
58 | "<?xml version=\"1.0\" encoding=\"utf-16\"?>", | ||
59 | "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:dep='http://schemas.microsoft.com/wix/DependencyExtension'>", | ||
60 | " <Fragment>", | ||
61 | " <ComponentGroup Id='Group1' Directory='INSTALLFOLDER'>", | ||
62 | " <Component>", | ||
63 | " <dep:Provides Key='abc'>", | ||
64 | " <dep:Requires Key='xyz' />", | ||
65 | " </dep:Provides>", | ||
66 | " </Component>", | ||
67 | " </ComponentGroup>", | ||
68 | " </Fragment>", | ||
69 | "</Wix>"); | ||
70 | |||
71 | var expected = new[] | ||
72 | { | ||
73 | "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\" xmlns:dep=\"http://wixtoolset.org/schemas/v4/wxs/dependency\">", | ||
74 | " <Fragment>", | ||
75 | " <ComponentGroup Id=\"Group1\" Directory=\"INSTALLFOLDER\">", | ||
76 | " <Component>", | ||
77 | " <Provides Key=\"abc\" dep:Check=\"yes\">", | ||
78 | " <Requires Key=\"xyz\" dep:Enforce=\"yes\" />", | ||
79 | " </Provides>", | ||
80 | " </Component>", | ||
81 | " </ComponentGroup>", | ||
82 | " </Fragment>", | ||
83 | "</Wix>" | ||
84 | }; | ||
85 | |||
86 | var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); | ||
87 | |||
88 | var messaging = new MockMessaging(); | ||
89 | var converter = new WixConverter(messaging, 2, null, null); | ||
90 | |||
91 | var errors = converter.ConvertDocument(document); | ||
92 | Assert.Equal(7, errors); | ||
93 | |||
94 | var actualLines = UnformattedDocumentLines(document); | ||
95 | WixAssert.CompareLineByLine(expected, actualLines); | ||
96 | } | ||
97 | |||
98 | [Fact] | ||
99 | public void FixPackageDependencyRequiresRef() | ||
100 | { | ||
101 | var parse = String.Join(Environment.NewLine, | ||
102 | "<?xml version=\"1.0\" encoding=\"utf-16\"?>", | ||
103 | "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:dep='http://schemas.microsoft.com/wix/DependencyExtension'>", | ||
104 | " <Fragment>", | ||
105 | " <ComponentGroup Id='Group1' Directory='INSTALLFOLDER'>", | ||
106 | " <Component>", | ||
107 | " <dep:Provides Key='abc'>", | ||
108 | " <dep:RequiresRef Id='OtherRequires' />", | ||
109 | " </dep:Provides>", | ||
110 | " </Component>", | ||
111 | " </ComponentGroup>", | ||
112 | " </Fragment>", | ||
113 | "</Wix>"); | ||
114 | |||
115 | var expected = new[] | ||
116 | { | ||
117 | "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\" xmlns:dep=\"http://wixtoolset.org/schemas/v4/wxs/dependency\">", | ||
118 | " <Fragment>", | ||
119 | " <ComponentGroup Id=\"Group1\" Directory=\"INSTALLFOLDER\">", | ||
120 | " <Component>", | ||
121 | " <Provides Key=\"abc\" dep:Check=\"yes\">", | ||
122 | " <RequiresRef Id=\"OtherRequires\" dep:Enforce=\"yes\" />", | ||
123 | " </Provides>", | ||
124 | " </Component>", | ||
125 | " </ComponentGroup>", | ||
126 | " </Fragment>", | ||
127 | "</Wix>" | ||
128 | }; | ||
129 | |||
130 | var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); | ||
131 | |||
132 | var messaging = new MockMessaging(); | ||
133 | var converter = new WixConverter(messaging, 2, null, null); | ||
134 | |||
135 | var errors = converter.ConvertDocument(document); | ||
136 | Assert.Equal(7, errors); | ||
137 | |||
138 | var actualLines = UnformattedDocumentLines(document); | ||
139 | WixAssert.CompareLineByLine(expected, actualLines); | ||
140 | } | ||
141 | |||
142 | [Fact] | ||
143 | public void FixBundleDependencyProvides() | ||
144 | { | ||
145 | var parse = String.Join(Environment.NewLine, | ||
146 | "<?xml version=\"1.0\" encoding=\"utf-16\"?>", | ||
147 | "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:dep='http://schemas.microsoft.com/wix/DependencyExtension'>", | ||
148 | " <Fragment>", | ||
149 | " <MsiPackage Id='Package1'>", | ||
150 | " <dep:Provides Key='abc' />", | ||
151 | " </MsiPackage>", | ||
152 | " </Fragment>", | ||
153 | "</Wix>"); | ||
154 | |||
155 | var expected = new[] | ||
156 | { | ||
157 | "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", | ||
158 | " <Fragment>", | ||
159 | " <MsiPackage Id=\"Package1\">", | ||
160 | " <Provides Key=\"abc\" />", | ||
161 | " </MsiPackage>", | ||
162 | " </Fragment>", | ||
163 | "</Wix>" | ||
164 | }; | ||
165 | |||
166 | var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); | ||
167 | |||
168 | var messaging = new MockMessaging(); | ||
169 | var converter = new WixConverter(messaging, 2, null, null); | ||
170 | |||
171 | var errors = converter.ConvertDocument(document); | ||
172 | Assert.Equal(5, errors); | ||
173 | |||
174 | var actualLines = UnformattedDocumentLines(document); | ||
175 | WixAssert.CompareLineByLine(expected, actualLines); | ||
176 | } | ||
177 | } | ||
178 | } | ||