diff options
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/WixToolsetTest.Converters/CustomTableFixture.cs | 178 |
1 files changed, 172 insertions, 6 deletions
diff --git a/src/test/WixToolsetTest.Converters/CustomTableFixture.cs b/src/test/WixToolsetTest.Converters/CustomTableFixture.cs index c51d1923..2b81a863 100644 --- a/src/test/WixToolsetTest.Converters/CustomTableFixture.cs +++ b/src/test/WixToolsetTest.Converters/CustomTableFixture.cs | |||
@@ -83,7 +83,7 @@ namespace WixToolsetTest.Converters | |||
83 | var converter = new WixConverter(messaging, 2, null, null); | 83 | var converter = new WixConverter(messaging, 2, null, null); |
84 | 84 | ||
85 | var errors = converter.ConvertDocument(document); | 85 | var errors = converter.ConvertDocument(document); |
86 | Assert.Equal(3, errors); | 86 | Assert.Equal(4, errors); |
87 | 87 | ||
88 | var actualLines = UnformattedDocumentLines(document); | 88 | var actualLines = UnformattedDocumentLines(document); |
89 | WixAssert.CompareLineByLine(expected, actualLines); | 89 | WixAssert.CompareLineByLine(expected, actualLines); |
@@ -126,7 +126,7 @@ namespace WixToolsetTest.Converters | |||
126 | var converter = new WixConverter(messaging, 2, null, null); | 126 | var converter = new WixConverter(messaging, 2, null, null); |
127 | 127 | ||
128 | var errors = converter.ConvertDocument(document); | 128 | var errors = converter.ConvertDocument(document); |
129 | Assert.Equal(2, errors); | 129 | Assert.Equal(3, errors); |
130 | 130 | ||
131 | var actualLines = UnformattedDocumentLines(document); | 131 | var actualLines = UnformattedDocumentLines(document); |
132 | WixAssert.CompareLineByLine(expected, actualLines); | 132 | WixAssert.CompareLineByLine(expected, actualLines); |
@@ -162,14 +162,154 @@ namespace WixToolsetTest.Converters | |||
162 | var converter = new WixConverter(messaging, 2, null, null); | 162 | var converter = new WixConverter(messaging, 2, null, null); |
163 | 163 | ||
164 | var errors = converter.ConvertDocument(document); | 164 | var errors = converter.ConvertDocument(document); |
165 | Assert.Equal(2, errors); | 165 | Assert.Equal(3, errors); |
166 | 166 | ||
167 | var actualLines = UnformattedDocumentLines(document); | 167 | var actualLines = UnformattedDocumentLines(document); |
168 | WixAssert.CompareLineByLine(expected, actualLines); | 168 | WixAssert.CompareLineByLine(expected, actualLines); |
169 | } | 169 | } |
170 | 170 | ||
171 | [Fact] | 171 | [Fact] |
172 | public void CanConvertCustomTableBootstrapperApplicationData() | 172 | public void CanConvertBundleCustomTableBootstrapperApplicationData() |
173 | { | ||
174 | var parse = String.Join(Environment.NewLine, | ||
175 | "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>", | ||
176 | " <CustomTable Id='FgAppx' BootstrapperApplicationData='yes'>", | ||
177 | " <Column Id='Column1' PrimaryKey='yes' Type='string' Width='0' Category='text' Description='The first custom column.' />", | ||
178 | " <Row>", | ||
179 | " <Data Column='Column1'>Row1</Data>", | ||
180 | " </Row>", | ||
181 | " </CustomTable>", | ||
182 | "</Wix>"); | ||
183 | |||
184 | var expected = String.Join(Environment.NewLine, | ||
185 | "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", | ||
186 | " <BundleCustomData Id=\"FgAppx\">", | ||
187 | " <BundleAttributeDefinition Id=\"Column1\" />", | ||
188 | " <BundleElement>", | ||
189 | " <BundleAttribute Id=\"Column1\" Value=\"Row1\" />", | ||
190 | " </BundleElement>", | ||
191 | " </BundleCustomData>", | ||
192 | "</Wix>"); | ||
193 | |||
194 | var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); | ||
195 | |||
196 | var messaging = new MockMessaging(); | ||
197 | var converter = new WixConverter(messaging, 2, customTableTarget: CustomTableTarget.Bundle); | ||
198 | |||
199 | var errors = converter.ConvertDocument(document); | ||
200 | |||
201 | var actual = UnformattedDocumentString(document); | ||
202 | |||
203 | Assert.Equal(2, errors); | ||
204 | Assert.Equal(expected, actual); | ||
205 | } | ||
206 | |||
207 | [Fact] | ||
208 | public void CanConvertBundleCustomTableRef() | ||
209 | { | ||
210 | var parse = String.Join(Environment.NewLine, | ||
211 | "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>", | ||
212 | " <CustomTable Id='FgAppx'>", | ||
213 | " <Row>", | ||
214 | " <Data Column='Column1'>Row1</Data>", | ||
215 | " </Row>", | ||
216 | " </CustomTable>", | ||
217 | "</Wix>"); | ||
218 | |||
219 | var expected = String.Join(Environment.NewLine, | ||
220 | "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", | ||
221 | " <BundleCustomDataRef Id=\"FgAppx\">", | ||
222 | " <BundleElement>", | ||
223 | " <BundleAttribute Id=\"Column1\" Value=\"Row1\" />", | ||
224 | " </BundleElement>", | ||
225 | " </BundleCustomDataRef>", | ||
226 | "</Wix>"); | ||
227 | |||
228 | var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); | ||
229 | |||
230 | var messaging = new MockMessaging(); | ||
231 | var converter = new WixConverter(messaging, 2, customTableTarget: CustomTableTarget.Bundle); | ||
232 | |||
233 | var errors = converter.ConvertDocument(document); | ||
234 | |||
235 | var actual = UnformattedDocumentString(document); | ||
236 | |||
237 | Assert.Equal(2, errors); | ||
238 | Assert.Equal(expected, actual); | ||
239 | } | ||
240 | |||
241 | [Fact] | ||
242 | public void CanConvertMsiCustomTableBootstrapperApplicationData() | ||
243 | { | ||
244 | var parse = String.Join(Environment.NewLine, | ||
245 | "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>", | ||
246 | " <CustomTable Id='FgAppx' BootstrapperApplicationData='yes'>", | ||
247 | " <Column Id='Column1' PrimaryKey='yes' Type='string' Width='0' Category='text' Description='The first custom column.' />", | ||
248 | " <Row>", | ||
249 | " <Data Column='Column1'>Row1</Data>", | ||
250 | " </Row>", | ||
251 | " </CustomTable>", | ||
252 | "</Wix>"); | ||
253 | |||
254 | var expected = String.Join(Environment.NewLine, | ||
255 | "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", | ||
256 | " <CustomTable Id=\"FgAppx\" Unreal=\"yes\">", | ||
257 | " <Column Id=\"Column1\" PrimaryKey=\"yes\" Type=\"string\" Width=\"0\" Category=\"text\" Description=\"The first custom column.\" />", | ||
258 | " <Row>", | ||
259 | " <Data Column=\"Column1\" Value=\"Row1\" />", | ||
260 | " </Row>", | ||
261 | " </CustomTable>", | ||
262 | "</Wix>"); | ||
263 | |||
264 | var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); | ||
265 | |||
266 | var messaging = new MockMessaging(); | ||
267 | var converter = new WixConverter(messaging, 2, customTableTarget: CustomTableTarget.Msi); | ||
268 | |||
269 | var errors = converter.ConvertDocument(document); | ||
270 | |||
271 | var actual = UnformattedDocumentString(document); | ||
272 | |||
273 | Assert.Equal(2, errors); | ||
274 | Assert.Equal(expected, actual); | ||
275 | } | ||
276 | |||
277 | [Fact] | ||
278 | public void CanConvertMsiCustomTableRef() | ||
279 | { | ||
280 | var parse = String.Join(Environment.NewLine, | ||
281 | "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>", | ||
282 | " <CustomTable Id='FgAppx'>", | ||
283 | " <Row>", | ||
284 | " <Data Column='Column1'>Row1</Data>", | ||
285 | " </Row>", | ||
286 | " </CustomTable>", | ||
287 | "</Wix>"); | ||
288 | |||
289 | var expected = String.Join(Environment.NewLine, | ||
290 | "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", | ||
291 | " <CustomTableRef Id=\"FgAppx\">", | ||
292 | " <Row>", | ||
293 | " <Data Column=\"Column1\" Value=\"Row1\" />", | ||
294 | " </Row>", | ||
295 | " </CustomTableRef>", | ||
296 | "</Wix>"); | ||
297 | |||
298 | var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); | ||
299 | |||
300 | var messaging = new MockMessaging(); | ||
301 | var converter = new WixConverter(messaging, 2, customTableTarget: CustomTableTarget.Msi); | ||
302 | |||
303 | var errors = converter.ConvertDocument(document); | ||
304 | |||
305 | var actual = UnformattedDocumentString(document); | ||
306 | |||
307 | Assert.Equal(2, errors); | ||
308 | Assert.Equal(expected, actual); | ||
309 | } | ||
310 | |||
311 | [Fact] | ||
312 | public void CanDetectAmbiguousCustomTableBootstrapperApplicationData() | ||
173 | { | 313 | { |
174 | var parse = String.Join(Environment.NewLine, | 314 | var parse = String.Join(Environment.NewLine, |
175 | "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>", | 315 | "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>", |
@@ -178,13 +318,39 @@ namespace WixToolsetTest.Converters | |||
178 | 318 | ||
179 | var expected = String.Join(Environment.NewLine, | 319 | var expected = String.Join(Environment.NewLine, |
180 | "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", | 320 | "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", |
181 | " <CustomTable Id=\"FgAppx\" Unreal=\"yes\" />", | 321 | " <CustomTable Id=\"FgAppx\" BootstrapperApplicationData=\"yes\" />", |
182 | "</Wix>"); | 322 | "</Wix>"); |
183 | 323 | ||
184 | var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); | 324 | var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); |
185 | 325 | ||
186 | var messaging = new MockMessaging(); | 326 | var messaging = new MockMessaging(); |
187 | var converter = new WixConverter(messaging, 2, null, null); | 327 | var converter = new WixConverter(messaging, 2); |
328 | |||
329 | var errors = converter.ConvertDocument(document); | ||
330 | |||
331 | var actual = UnformattedDocumentString(document); | ||
332 | |||
333 | Assert.Equal(1, errors); | ||
334 | Assert.Equal(expected, actual); | ||
335 | } | ||
336 | |||
337 | [Fact] | ||
338 | public void CanRemoveBootstrapperApplicationDataFromRealCustomTable() | ||
339 | { | ||
340 | var parse = String.Join(Environment.NewLine, | ||
341 | "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>", | ||
342 | " <CustomTable Id='FgAppx' BootstrapperApplicationData='no' />", | ||
343 | "</Wix>"); | ||
344 | |||
345 | var expected = String.Join(Environment.NewLine, | ||
346 | "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", | ||
347 | " <CustomTable Id=\"FgAppx\" />", | ||
348 | "</Wix>"); | ||
349 | |||
350 | var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); | ||
351 | |||
352 | var messaging = new MockMessaging(); | ||
353 | var converter = new WixConverter(messaging, 2); | ||
188 | 354 | ||
189 | var errors = converter.ConvertDocument(document); | 355 | var errors = converter.ConvertDocument(document); |
190 | 356 | ||