aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2021-04-27 22:37:33 -0700
committerRob Mensching <rob@firegiant.com>2021-04-27 22:37:33 -0700
commit612dc390ecd90bf4079ad7545f4a4832ce8f702d (patch)
treed027ac1e327ef78c83b722ab28e293a6bbeb7a78 /src/test
parent0177cb5b9b08351266816097ea9e8561b9ec0973 (diff)
downloadwix-612dc390ecd90bf4079ad7545f4a4832ce8f702d.tar.gz
wix-612dc390ecd90bf4079ad7545f4a4832ce8f702d.tar.bz2
wix-612dc390ecd90bf4079ad7545f4a4832ce8f702d.zip
Move Converters into wix
Diffstat (limited to 'src/test')
-rw-r--r--src/test/WixToolsetTest.Converters.Symbolizer/ConvertSymbolsFixture.cs606
-rw-r--r--src/test/WixToolsetTest.Converters.Symbolizer/TestData/Integration/test.wixoutbin148559 -> 0 bytes
-rw-r--r--src/test/WixToolsetTest.Converters.Symbolizer/TestData/Integration/test.wixproj47
-rw-r--r--src/test/WixToolsetTest.Converters.Symbolizer/TestData/Integration/test.wxs36
-rw-r--r--src/test/WixToolsetTest.Converters.Symbolizer/WixToolsetTest.Converters.Symbolizer.csproj33
-rw-r--r--src/test/WixToolsetTest.Converters.Symbolizer/WixToolsetTest.Converters.Symbolizer.v3.ncrunchproject9
-rw-r--r--src/test/WixToolsetTest.Converters/BaseConverterFixture.cs33
-rw-r--r--src/test/WixToolsetTest.Converters/BitnessFixture.cs187
-rw-r--r--src/test/WixToolsetTest.Converters/BootstrapperApplicationFixture.cs418
-rw-r--r--src/test/WixToolsetTest.Converters/ConditionFixture.cs297
-rw-r--r--src/test/WixToolsetTest.Converters/ConverterFixture.cs449
-rw-r--r--src/test/WixToolsetTest.Converters/ConverterIntegrationFixture.cs195
-rw-r--r--src/test/WixToolsetTest.Converters/CustomActionFixture.cs88
-rw-r--r--src/test/WixToolsetTest.Converters/CustomTableFixture.cs363
-rw-r--r--src/test/WixToolsetTest.Converters/DependencyFixture.cs178
-rw-r--r--src/test/WixToolsetTest.Converters/DirectoryFixture.cs92
-rw-r--r--src/test/WixToolsetTest.Converters/ExePackageFixture.cs49
-rw-r--r--src/test/WixToolsetTest.Converters/FeatureFixture.cs110
-rw-r--r--src/test/WixToolsetTest.Converters/FirewallExtensionFixture.cs47
-rw-r--r--src/test/WixToolsetTest.Converters/FormatFixture.cs117
-rw-r--r--src/test/WixToolsetTest.Converters/IncludeFixture.cs68
-rw-r--r--src/test/WixToolsetTest.Converters/Mocks/MockCoreServiceProvider.cs51
-rw-r--r--src/test/WixToolsetTest.Converters/Mocks/MockMessaging.cs39
-rw-r--r--src/test/WixToolsetTest.Converters/ProductPackageFixture.cs278
-rw-r--r--src/test/WixToolsetTest.Converters/PropertyFixture.cs108
-rw-r--r--src/test/WixToolsetTest.Converters/RegistryFixture.cs54
-rw-r--r--src/test/WixToolsetTest.Converters/RemotePayloadFixture.cs104
-rw-r--r--src/test/WixToolsetTest.Converters/SequenceFixture.cs49
-rw-r--r--src/test/WixToolsetTest.Converters/TagFixture.cs111
-rw-r--r--src/test/WixToolsetTest.Converters/TestData/PackageSummaryInformation/TypicalV3.msibin32768 -> 0 bytes
-rw-r--r--src/test/WixToolsetTest.Converters/TestData/PackageSummaryInformation/TypicalV3.wxs37
-rw-r--r--src/test/WixToolsetTest.Converters/TestData/PermissionEx/v3.wxs26
-rw-r--r--src/test/WixToolsetTest.Converters/TestData/PermissionEx/v4_expected.wxs26
-rw-r--r--src/test/WixToolsetTest.Converters/TestData/Preprocessor/ConvertedPreprocessor.wxs61
-rw-r--r--src/test/WixToolsetTest.Converters/TestData/Preprocessor/Preprocessor.wxs63
-rw-r--r--src/test/WixToolsetTest.Converters/TestData/Preprocessor/wixcop.settings.xml9
-rw-r--r--src/test/WixToolsetTest.Converters/TestData/QtExec.bad/v3.wxs64
-rw-r--r--src/test/WixToolsetTest.Converters/TestData/QtExec.bad/v4_expected.wxs63
-rw-r--r--src/test/WixToolsetTest.Converters/TestData/QtExec/v3.wxs64
-rw-r--r--src/test/WixToolsetTest.Converters/TestData/QtExec/v4_expected.wxs62
-rw-r--r--src/test/WixToolsetTest.Converters/TestData/SingleFile/ConvertedSingleFile.wxs59
-rw-r--r--src/test/WixToolsetTest.Converters/TestData/SingleFile/SingleFile.wxs61
-rw-r--r--src/test/WixToolsetTest.Converters/UtilExtensionFixture.cs190
-rw-r--r--src/test/WixToolsetTest.Converters/VariableFixture.cs86
-rw-r--r--src/test/WixToolsetTest.Converters/Wix4ConversionFixture.cs54
-rw-r--r--src/test/WixToolsetTest.Converters/WixToolsetTest.Converters.csproj31
46 files changed, 0 insertions, 5172 deletions
diff --git a/src/test/WixToolsetTest.Converters.Symbolizer/ConvertSymbolsFixture.cs b/src/test/WixToolsetTest.Converters.Symbolizer/ConvertSymbolsFixture.cs
deleted file mode 100644
index 01213524..00000000
--- a/src/test/WixToolsetTest.Converters.Symbolizer/ConvertSymbolsFixture.cs
+++ /dev/null
@@ -1,606 +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
3namespace WixToolsetTest.Converters.Symbolizer
4{
5 using System;
6 using System.Collections.Generic;
7 using System.IO;
8 using System.Linq;
9 using WixBuildTools.TestSupport;
10 using Wix3 = Microsoft.Tools.WindowsInstallerXml;
11 using WixToolset.Converters.Symbolizer;
12 using WixToolset.Data;
13 using WixToolset.Data.WindowsInstaller;
14 using WixToolset.Data.Symbols;
15 using Xunit;
16
17 public class ConvertSymbolsFixture
18 {
19 [Fact]
20 public void CanLoadWixoutAndConvertToIntermediate()
21 {
22 var rootFolder = TestData.Get();
23 var dataFolder = TestData.Get(@"TestData\Integration");
24
25 using (var fs = new DisposableFileSystem())
26 {
27 var intermediateFolder = fs.GetFolder();
28
29 var path = Path.Combine(dataFolder, "test.wixout");
30
31 var intermediate = ConvertSymbols.ConvertFile(path);
32
33 Assert.NotNull(intermediate);
34 Assert.Single(intermediate.Sections);
35 Assert.Equal(String.Empty, intermediate.Id);
36
37 // Save and load to guarantee round-tripping support.
38 //
39 var wixiplFile = Path.Combine(intermediateFolder, "test.wixipl");
40 intermediate.Save(wixiplFile);
41
42 intermediate = Intermediate.Load(wixiplFile);
43
44 var output = Wix3.Output.Load(path, suppressVersionCheck: true, suppressSchema: true);
45 var wixMediaByDiskId = IndexWixMediaTableByDiskId(output);
46
47 // Dump to text for easy diffing, with some massaging to keep v3 and v4 diffable.
48 //
49 var tables = output.Tables.Cast<Wix3.Table>();
50 var wix3Dump = tables
51 .SelectMany(table => table.Rows.Cast<Wix3.Row>()
52 .SelectMany(row => RowToStrings(row, wixMediaByDiskId)))
53 .Where(s => !String.IsNullOrEmpty(s))
54 .OrderBy(s => s)
55 .ToArray();
56
57 var symbols = intermediate.Sections.SelectMany(s => s.Symbols);
58
59 var assemblySymbolsByFileId = symbols.OfType<AssemblySymbol>().ToDictionary(a => a.Id.Id);
60
61 var wix4Dump = symbols
62 .SelectMany(symbol => SymbolToStrings(symbol, assemblySymbolsByFileId))
63 .OrderBy(s => s)
64 .ToArray();
65
66#if false
67 Assert.Equal(wix3Dump, wix4Dump);
68#else // useful when you want to diff the outputs with another diff tool.
69 var wix3TextDump = String.Join(Environment.NewLine, wix3Dump);
70 var wix4TextDump = String.Join(Environment.NewLine, wix4Dump);
71
72 var path3 = Path.Combine(Path.GetTempPath(), "~3.txt");
73 var path4 = Path.Combine(Path.GetTempPath(), "~4.txt");
74
75 File.WriteAllText(path3, wix3TextDump);
76 File.WriteAllText(path4, wix4TextDump);
77
78 Assert.Equal(wix3TextDump, wix4TextDump);
79#endif
80 }
81 }
82
83 private static Dictionary<int, Wix3.WixMediaRow> IndexWixMediaTableByDiskId(Wix3.Output output)
84 {
85 var wixMediaByDiskId = new Dictionary<int, Wix3.WixMediaRow>();
86 var wixMediaTable = output.Tables["WixMedia"];
87
88 if (wixMediaTable != null)
89 {
90 foreach (Wix3.WixMediaRow row in wixMediaTable.Rows)
91 {
92 wixMediaByDiskId.Add((int)row[0], row);
93 }
94 }
95
96 return wixMediaByDiskId;
97 }
98
99 private static IEnumerable<string> RowToStrings(Wix3.Row row, Dictionary<int, Wix3.WixMediaRow> wixMediaByDiskId)
100 {
101 string fields = null;
102
103 // Massage output to match WiX v3 rows and v4 symbols.
104 //
105 switch (row.Table.Name)
106 {
107 case "Directory":
108 var dirs = SplitDefaultDir((string)row[2]);
109 fields = String.Join(",", row[0], row[1], dirs[0], dirs[1], dirs[2], dirs[3]);
110 break;
111 case "File":
112 {
113 var fieldValues = row.Fields.Take(7).Select(SafeConvertField).ToArray();
114 if (fieldValues[3] == null)
115 {
116 // "Somebody" sometimes writes out a null field even when the column definition says
117 // it's non-nullable. Not naming names or anything. (SWID tags.)
118 fieldValues[3] = "0";
119 }
120 fields = String.Join(",", fieldValues);
121 break;
122 }
123 case "Media":
124 var compression = wixMediaByDiskId.TryGetValue((int)row[0], out var wixMedia) ? (CompressionLevel?)Enum.Parse(typeof(CompressionLevel), SafeConvertField(wixMedia.Fields[1]), true) : null;
125
126 fields = String.Join(",", row.Fields.Select(SafeConvertField));
127 fields = String.Join(",", fields, (int?)compression, SafeConvertField(wixMedia?.Fields[2]));
128 break;
129 case "RegLocator":
130 var type = (int)row[4];
131 fields = String.Join(",", row[0], row[1], row[2], row[3], type & 0xF, (type & 0x10) == 0x10);
132 break;
133 case "RemoveFile":
134 var attributes = (int)row[4];
135 var onInstall = (attributes & 1) == 1 ? (bool?)true : null;
136 var onUninstall = (attributes & 2) == 2 ? (bool?)true : null;
137 fields = String.Join(",", row.Fields.Take(4).Select(SafeConvertField));
138 fields = String.Join(",", fields, onInstall, onUninstall);
139 break;
140 case "Shortcut":
141 var split = ((string)row[2]).Split('|');
142 var afterName = String.Join(",", row.Fields.Skip(3).Select(SafeConvertField));
143 fields = String.Join(",", row[0], row[1], split.Length > 1 ? split[1] : split[0], split.Length > 1 ? split[0] : String.Empty, afterName);
144 break;
145 case "WixAction":
146 var table = (int)SequenceStringToSequenceTable(row[0]);
147 fields = String.Join(",", table, row[1], row[2], row[3], row[4], row[5], row[6]);
148 break;
149 case "WixFile":
150 {
151 var fieldValues = row.Fields.Select(SafeConvertField).ToArray();
152 if (fieldValues[8] == null)
153 {
154 // "Somebody" sometimes writes out a null field even when the column definition says
155 // it's non-nullable. Not naming names or anything. (SWID tags.)
156 fieldValues[8] = "0";
157 }
158 if (fieldValues[10] == null)
159 {
160 // WixFile rows that come from merge modules will not have the attributes column set
161 // so initilaize with 0.
162 fieldValues[10] = "0";
163 }
164 fields = String.Join(",", fieldValues);
165 break;
166 }
167 case "WixMedia":
168 break;
169 default:
170 fields = String.Join(",", row.Fields.Select(SafeConvertField));
171 break;
172 }
173
174 if (fields != null)
175 {
176 yield return $"{row.Table.Name}:{fields}";
177 }
178 }
179
180 private static IEnumerable<string> SymbolToStrings(IntermediateSymbol symbol, Dictionary<string, AssemblySymbol> assemblySymbolsByFileId)
181 {
182 var name = symbol.Definition.Type == SymbolDefinitionType.SummaryInformation ? "_SummaryInformation" : symbol.Definition.Name;
183 var id = symbol.Id?.Id ?? String.Empty;
184
185 string fields;
186 switch (symbol.Definition.Name)
187 {
188 // Massage output to match WiX v3 rows and v4 symbols.
189 //
190 case "Component":
191 {
192 var componentSymbol = (ComponentSymbol)symbol;
193 var attributes = ComponentLocation.Either == componentSymbol.Location ? WindowsInstallerConstants.MsidbComponentAttributesOptional : 0;
194 attributes |= ComponentLocation.SourceOnly == componentSymbol.Location ? WindowsInstallerConstants.MsidbComponentAttributesSourceOnly : 0;
195 attributes |= ComponentKeyPathType.Registry == componentSymbol.KeyPathType ? WindowsInstallerConstants.MsidbComponentAttributesRegistryKeyPath : 0;
196 attributes |= ComponentKeyPathType.OdbcDataSource == componentSymbol.KeyPathType ? WindowsInstallerConstants.MsidbComponentAttributesODBCDataSource : 0;
197 attributes |= componentSymbol.DisableRegistryReflection ? WindowsInstallerConstants.MsidbComponentAttributesDisableRegistryReflection : 0;
198 attributes |= componentSymbol.NeverOverwrite ? WindowsInstallerConstants.MsidbComponentAttributesNeverOverwrite : 0;
199 attributes |= componentSymbol.Permanent ? WindowsInstallerConstants.MsidbComponentAttributesPermanent : 0;
200 attributes |= componentSymbol.SharedDllRefCount ? WindowsInstallerConstants.MsidbComponentAttributesSharedDllRefCount : 0;
201 attributes |= componentSymbol.Shared ? WindowsInstallerConstants.MsidbComponentAttributesShared : 0;
202 attributes |= componentSymbol.Transitive ? WindowsInstallerConstants.MsidbComponentAttributesTransitive : 0;
203 attributes |= componentSymbol.UninstallWhenSuperseded ? WindowsInstallerConstants.MsidbComponentAttributes64bit : 0;
204 attributes |= componentSymbol.Win64 ? WindowsInstallerConstants.MsidbComponentAttributes64bit : 0;
205
206 fields = String.Join(",",
207 componentSymbol.ComponentId,
208 componentSymbol.DirectoryRef,
209 attributes.ToString(),
210 componentSymbol.Condition,
211 componentSymbol.KeyPath
212 );
213 break;
214 }
215 case "CustomAction":
216 {
217 var customActionSymbol = (CustomActionSymbol)symbol;
218 var type = customActionSymbol.Win64 ? WindowsInstallerConstants.MsidbCustomActionType64BitScript : 0;
219 type |= customActionSymbol.TSAware ? WindowsInstallerConstants.MsidbCustomActionTypeTSAware : 0;
220 type |= customActionSymbol.Impersonate ? 0 : WindowsInstallerConstants.MsidbCustomActionTypeNoImpersonate;
221 type |= customActionSymbol.IgnoreResult ? WindowsInstallerConstants.MsidbCustomActionTypeContinue : 0;
222 type |= customActionSymbol.Hidden ? WindowsInstallerConstants.MsidbCustomActionTypeHideTarget : 0;
223 type |= customActionSymbol.Async ? WindowsInstallerConstants.MsidbCustomActionTypeAsync : 0;
224 type |= CustomActionExecutionType.FirstSequence == customActionSymbol.ExecutionType ? WindowsInstallerConstants.MsidbCustomActionTypeFirstSequence : 0;
225 type |= CustomActionExecutionType.OncePerProcess == customActionSymbol.ExecutionType ? WindowsInstallerConstants.MsidbCustomActionTypeOncePerProcess : 0;
226 type |= CustomActionExecutionType.ClientRepeat == customActionSymbol.ExecutionType ? WindowsInstallerConstants.MsidbCustomActionTypeClientRepeat : 0;
227 type |= CustomActionExecutionType.Deferred == customActionSymbol.ExecutionType ? WindowsInstallerConstants.MsidbCustomActionTypeInScript : 0;
228 type |= CustomActionExecutionType.Rollback == customActionSymbol.ExecutionType ? WindowsInstallerConstants.MsidbCustomActionTypeInScript | WindowsInstallerConstants.MsidbCustomActionTypeRollback : 0;
229 type |= CustomActionExecutionType.Commit == customActionSymbol.ExecutionType ? WindowsInstallerConstants.MsidbCustomActionTypeInScript | WindowsInstallerConstants.MsidbCustomActionTypeCommit : 0;
230 type |= CustomActionSourceType.File == customActionSymbol.SourceType ? WindowsInstallerConstants.MsidbCustomActionTypeSourceFile : 0;
231 type |= CustomActionSourceType.Directory == customActionSymbol.SourceType ? WindowsInstallerConstants.MsidbCustomActionTypeDirectory : 0;
232 type |= CustomActionSourceType.Property == customActionSymbol.SourceType ? WindowsInstallerConstants.MsidbCustomActionTypeProperty : 0;
233 type |= CustomActionTargetType.Dll == customActionSymbol.TargetType ? WindowsInstallerConstants.MsidbCustomActionTypeDll : 0;
234 type |= CustomActionTargetType.Exe == customActionSymbol.TargetType ? WindowsInstallerConstants.MsidbCustomActionTypeExe : 0;
235 type |= CustomActionTargetType.TextData == customActionSymbol.TargetType ? WindowsInstallerConstants.MsidbCustomActionTypeTextData : 0;
236 type |= CustomActionTargetType.JScript == customActionSymbol.TargetType ? WindowsInstallerConstants.MsidbCustomActionTypeJScript : 0;
237 type |= CustomActionTargetType.VBScript == customActionSymbol.TargetType ? WindowsInstallerConstants.MsidbCustomActionTypeVBScript : 0;
238
239 fields = String.Join(",",
240 type.ToString(),
241 customActionSymbol.Source,
242 customActionSymbol.Target,
243 customActionSymbol.PatchUninstall ? WindowsInstallerConstants.MsidbCustomActionTypePatchUninstall.ToString() : null
244 );
245 break;
246 }
247 case "Directory":
248 {
249 var directorySymbol = (DirectorySymbol)symbol;
250
251 if (!String.IsNullOrEmpty(directorySymbol.ComponentGuidGenerationSeed))
252 {
253 yield return $"WixDirectory:{directorySymbol.Id.Id},{directorySymbol.ComponentGuidGenerationSeed}";
254 }
255
256 fields = String.Join(",", directorySymbol.ParentDirectoryRef, directorySymbol.Name, directorySymbol.ShortName, directorySymbol.SourceName, directorySymbol.SourceShortName);
257 break;
258 }
259 case "Feature":
260 {
261 var featureSymbol = (FeatureSymbol)symbol;
262 var attributes = featureSymbol.DisallowAbsent ? WindowsInstallerConstants.MsidbFeatureAttributesUIDisallowAbsent : 0;
263 attributes |= featureSymbol.DisallowAdvertise ? WindowsInstallerConstants.MsidbFeatureAttributesDisallowAdvertise : 0;
264 attributes |= FeatureInstallDefault.FollowParent == featureSymbol.InstallDefault ? WindowsInstallerConstants.MsidbFeatureAttributesFollowParent : 0;
265 attributes |= FeatureInstallDefault.Source == featureSymbol.InstallDefault ? WindowsInstallerConstants.MsidbFeatureAttributesFavorSource : 0;
266 attributes |= FeatureTypicalDefault.Advertise == featureSymbol.TypicalDefault ? WindowsInstallerConstants.MsidbFeatureAttributesFavorAdvertise : 0;
267
268 fields = String.Join(",",
269 featureSymbol.ParentFeatureRef,
270 featureSymbol.Title,
271 featureSymbol.Description,
272 featureSymbol.Display.ToString(),
273 featureSymbol.Level.ToString(),
274 featureSymbol.DirectoryRef,
275 attributes.ToString());
276 break;
277 }
278 case "File":
279 {
280 var fileSymbol = (FileSymbol)symbol;
281
282 if (fileSymbol.BindPath != null)
283 {
284 yield return $"BindImage:{fileSymbol.Id.Id},{fileSymbol.BindPath}";
285 }
286
287 if (fileSymbol.FontTitle != null)
288 {
289 yield return $"Font:{fileSymbol.Id.Id},{fileSymbol.FontTitle}";
290 }
291
292 if (fileSymbol.SelfRegCost.HasValue)
293 {
294 yield return $"SelfReg:{fileSymbol.Id.Id},{fileSymbol.SelfRegCost}";
295 }
296
297 int? assemblyAttributes = null;
298 if (assemblySymbolsByFileId.TryGetValue(fileSymbol.Id.Id, out var assemblySymbol))
299 {
300 if (assemblySymbol.Type == AssemblyType.DotNetAssembly)
301 {
302 assemblyAttributes = 0;
303 }
304 else if (assemblySymbol.Type == AssemblyType.Win32Assembly)
305 {
306 assemblyAttributes = 1;
307 }
308 }
309
310 yield return "WixFile:" + String.Join(",",
311 fileSymbol.Id.Id,
312 assemblyAttributes,
313 assemblySymbol?.ManifestFileRef,
314 assemblySymbol?.ApplicationFileRef,
315 fileSymbol.DirectoryRef,
316 fileSymbol.DiskId,
317 fileSymbol.Source.Path,
318 null, // assembly processor arch
319 fileSymbol.PatchGroup,
320 0,
321 (int)fileSymbol.PatchAttributes,
322 fileSymbol.RetainLengths,
323 fileSymbol.IgnoreOffsets,
324 fileSymbol.IgnoreLengths,
325 fileSymbol.RetainOffsets
326 );
327
328 var fileAttributes = 0;
329 fileAttributes |= (fileSymbol.Attributes & FileSymbolAttributes.ReadOnly) != 0 ? WindowsInstallerConstants.MsidbFileAttributesReadOnly : 0;
330 fileAttributes |= (fileSymbol.Attributes & FileSymbolAttributes.Hidden) != 0 ? WindowsInstallerConstants.MsidbFileAttributesHidden : 0;
331 fileAttributes |= (fileSymbol.Attributes & FileSymbolAttributes.System) != 0 ? WindowsInstallerConstants.MsidbFileAttributesSystem : 0;
332 fileAttributes |= (fileSymbol.Attributes & FileSymbolAttributes.Vital) != 0 ? WindowsInstallerConstants.MsidbFileAttributesVital : 0;
333 fileAttributes |= (fileSymbol.Attributes & FileSymbolAttributes.Checksum) != 0 ? WindowsInstallerConstants.MsidbFileAttributesChecksum : 0;
334 fileAttributes |= (fileSymbol.Attributes & FileSymbolAttributes.Compressed) != 0 ? WindowsInstallerConstants.MsidbFileAttributesCompressed : 0;
335 fileAttributes |= (fileSymbol.Attributes & FileSymbolAttributes.Uncompressed) != 0 ? WindowsInstallerConstants.MsidbFileAttributesNoncompressed : 0;
336
337 fields = String.Join(",",
338 fileSymbol.ComponentRef,
339 fileSymbol.Name,
340 fileSymbol.FileSize.ToString(),
341 fileSymbol.Version,
342 fileSymbol.Language,
343 fileAttributes);
344 break;
345 }
346
347 case "Media":
348 fields = String.Join(",", symbol.Fields.Skip(1).Select(SafeConvertField));
349 break;
350
351 case "Assembly":
352 {
353 var assemblySymbol = (AssemblySymbol)symbol;
354
355 id = null;
356 name = "MsiAssembly";
357 fields = String.Join(",", assemblySymbol.ComponentRef, assemblySymbol.FeatureRef, assemblySymbol.ManifestFileRef, assemblySymbol.ApplicationFileRef, assemblySymbol.Type == AssemblyType.Win32Assembly ? 1 : 0);
358 break;
359 }
360 case "RegLocator":
361 {
362 var locatorSymbol = (RegLocatorSymbol)symbol;
363
364 fields = String.Join(",", (int)locatorSymbol.Root, locatorSymbol.Key, locatorSymbol.Name, (int)locatorSymbol.Type, locatorSymbol.Win64);
365 break;
366 }
367 case "Registry":
368 {
369 var registrySymbol = (RegistrySymbol)symbol;
370 var value = registrySymbol.Value;
371
372 switch (registrySymbol.ValueType)
373 {
374 case RegistryValueType.Binary:
375 value = String.Concat("#x", value);
376 break;
377 case RegistryValueType.Expandable:
378 value = String.Concat("#%", value);
379 break;
380 case RegistryValueType.Integer:
381 value = String.Concat("#", value);
382 break;
383 case RegistryValueType.MultiString:
384 switch (registrySymbol.ValueAction)
385 {
386 case RegistryValueActionType.Append:
387 value = String.Concat("[~]", value);
388 break;
389 case RegistryValueActionType.Prepend:
390 value = String.Concat(value, "[~]");
391 break;
392 case RegistryValueActionType.Write:
393 default:
394 if (null != value && -1 == value.IndexOf("[~]", StringComparison.Ordinal))
395 {
396 value = String.Concat("[~]", value, "[~]");
397 }
398 break;
399 }
400 break;
401 case RegistryValueType.String:
402 // escape the leading '#' character for string registry keys
403 if (null != value && value.StartsWith("#", StringComparison.Ordinal))
404 {
405 value = String.Concat("#", value);
406 }
407 break;
408 }
409
410 fields = String.Join(",",
411 ((int)registrySymbol.Root).ToString(),
412 registrySymbol.Key,
413 registrySymbol.Name,
414 value,
415 registrySymbol.ComponentRef
416 );
417 break;
418 }
419
420 case "RemoveRegistry":
421 {
422 var removeRegistrySymbol = (RemoveRegistrySymbol)symbol;
423 fields = String.Join(",",
424 ((int)removeRegistrySymbol.Root).ToString(),
425 removeRegistrySymbol.Key,
426 removeRegistrySymbol.Name,
427 removeRegistrySymbol.ComponentRef
428 );
429 break;
430 }
431
432 case "ServiceControl":
433 {
434 var serviceControlSymbol = (ServiceControlSymbol)symbol;
435
436 var events = serviceControlSymbol.InstallRemove ? WindowsInstallerConstants.MsidbServiceControlEventDelete : 0;
437 events |= serviceControlSymbol.UninstallRemove ? WindowsInstallerConstants.MsidbServiceControlEventUninstallDelete : 0;
438 events |= serviceControlSymbol.InstallStart ? WindowsInstallerConstants.MsidbServiceControlEventStart : 0;
439 events |= serviceControlSymbol.UninstallStart ? WindowsInstallerConstants.MsidbServiceControlEventUninstallStart : 0;
440 events |= serviceControlSymbol.InstallStop ? WindowsInstallerConstants.MsidbServiceControlEventStop : 0;
441 events |= serviceControlSymbol.UninstallStop ? WindowsInstallerConstants.MsidbServiceControlEventUninstallStop : 0;
442
443 fields = String.Join(",",
444 serviceControlSymbol.Name,
445 events.ToString(),
446 serviceControlSymbol.Arguments,
447 serviceControlSymbol.Wait == true ? "1" : "0",
448 serviceControlSymbol.ComponentRef
449 );
450 break;
451 }
452
453 case "ServiceInstall":
454 {
455 var serviceInstallSymbol = (ServiceInstallSymbol)symbol;
456
457 var errorControl = (int)serviceInstallSymbol.ErrorControl;
458 errorControl |= serviceInstallSymbol.Vital ? WindowsInstallerConstants.MsidbServiceInstallErrorControlVital : 0;
459
460 var serviceType = (int)serviceInstallSymbol.ServiceType;
461 serviceType |= serviceInstallSymbol.Interactive ? WindowsInstallerConstants.MsidbServiceInstallInteractive : 0;
462
463 fields = String.Join(",",
464 serviceInstallSymbol.Name,
465 serviceInstallSymbol.DisplayName,
466 serviceType.ToString(),
467 ((int)serviceInstallSymbol.StartType).ToString(),
468 errorControl.ToString(),
469 serviceInstallSymbol.LoadOrderGroup,
470 serviceInstallSymbol.Dependencies,
471 serviceInstallSymbol.StartName,
472 serviceInstallSymbol.Password,
473 serviceInstallSymbol.Arguments,
474 serviceInstallSymbol.ComponentRef,
475 serviceInstallSymbol.Description
476 );
477 break;
478 }
479
480 case "Upgrade":
481 {
482 var upgradeSymbol = (UpgradeSymbol)symbol;
483
484 var attributes = upgradeSymbol.MigrateFeatures ? WindowsInstallerConstants.MsidbUpgradeAttributesMigrateFeatures : 0;
485 attributes |= upgradeSymbol.OnlyDetect ? WindowsInstallerConstants.MsidbUpgradeAttributesOnlyDetect : 0;
486 attributes |= upgradeSymbol.IgnoreRemoveFailures ? WindowsInstallerConstants.MsidbUpgradeAttributesIgnoreRemoveFailure : 0;
487 attributes |= upgradeSymbol.VersionMinInclusive ? WindowsInstallerConstants.MsidbUpgradeAttributesVersionMinInclusive : 0;
488 attributes |= upgradeSymbol.VersionMaxInclusive ? WindowsInstallerConstants.MsidbUpgradeAttributesVersionMaxInclusive : 0;
489 attributes |= upgradeSymbol.ExcludeLanguages ? WindowsInstallerConstants.MsidbUpgradeAttributesLanguagesExclusive : 0;
490
491 fields = String.Join(",",
492 upgradeSymbol.VersionMin,
493 upgradeSymbol.VersionMax,
494 upgradeSymbol.Language,
495 attributes.ToString(),
496 upgradeSymbol.Remove,
497 upgradeSymbol.ActionProperty
498 );
499 break;
500 }
501
502 case "WixAction":
503 {
504 var wixActionSymbol = (WixActionSymbol)symbol;
505 var data = wixActionSymbol.Fields[(int)WixActionSymbolFields.SequenceTable].AsObject();
506 var sequenceTableAsInt = data is string ? (int)SequenceStringToSequenceTable(data) : (int)wixActionSymbol.SequenceTable;
507
508 fields = String.Join(",",
509 sequenceTableAsInt,
510 wixActionSymbol.Action,
511 wixActionSymbol.Condition,
512 wixActionSymbol.Sequence?.ToString() ?? String.Empty,
513 wixActionSymbol.Before,
514 wixActionSymbol.After,
515 wixActionSymbol.Overridable == true ? "1" : "0"
516 );
517 break;
518 }
519
520 case "WixComplexReference":
521 {
522 var wixComplexReferenceSymbol = (WixComplexReferenceSymbol)symbol;
523 fields = String.Join(",",
524 wixComplexReferenceSymbol.Parent,
525 (int)wixComplexReferenceSymbol.ParentType,
526 wixComplexReferenceSymbol.ParentLanguage,
527 wixComplexReferenceSymbol.Child,
528 (int)wixComplexReferenceSymbol.ChildType,
529 wixComplexReferenceSymbol.IsPrimary ? "1" : "0"
530 );
531 break;
532 }
533
534 case "WixProperty":
535 {
536 var wixPropertySymbol = (WixPropertySymbol)symbol;
537 var attributes = wixPropertySymbol.Admin ? 0x1 : 0;
538 attributes |= wixPropertySymbol.Hidden ? 0x2 : 0;
539 attributes |= wixPropertySymbol.Secure ? 0x4 : 0;
540
541 fields = String.Join(",",
542 wixPropertySymbol.PropertyRef,
543 attributes.ToString()
544 );
545 break;
546 }
547
548 default:
549 fields = String.Join(",", symbol.Fields.Select(SafeConvertField));
550 break;
551 }
552
553 fields = String.IsNullOrEmpty(id) ? fields : String.IsNullOrEmpty(fields) ? id : $"{id},{fields}";
554 yield return $"{name}:{fields}";
555 }
556
557 private static SequenceTable SequenceStringToSequenceTable(object sequenceString)
558 {
559 switch (sequenceString)
560 {
561 case "AdminExecuteSequence":
562 return SequenceTable.AdminExecuteSequence;
563 case "AdminUISequence":
564 return SequenceTable.AdminUISequence;
565 case "AdvtExecuteSequence":
566 return SequenceTable.AdvertiseExecuteSequence;
567 case "InstallExecuteSequence":
568 return SequenceTable.InstallExecuteSequence;
569 case "InstallUISequence":
570 return SequenceTable.InstallUISequence;
571 default:
572 throw new ArgumentException($"Unknown sequence: {sequenceString}");
573 }
574 }
575
576 private static string SafeConvertField(Wix3.Field field)
577 {
578 return field?.Data?.ToString();
579 }
580
581 private static string SafeConvertField(IntermediateField field)
582 {
583 var data = field.AsObject();
584 if (data is IntermediateFieldPathValue path)
585 {
586 return path.Path;
587 }
588
589 return data?.ToString();
590 }
591
592 private static string[] SplitDefaultDir(string defaultDir)
593 {
594 var split1 = defaultDir.Split(':');
595 var targetSplit = split1.Length > 1 ? split1[1].Split('|') : split1[0].Split('|');
596 var sourceSplit = split1.Length > 1 ? split1[0].Split('|') : new[] { String.Empty };
597 return new[]
598 {
599 targetSplit.Length > 1 ? targetSplit[1] : targetSplit[0],
600 targetSplit.Length > 1 ? targetSplit[0] : String.Empty,
601 sourceSplit.Length > 1 ? sourceSplit[1] : sourceSplit[0],
602 sourceSplit.Length > 1 ? sourceSplit[0] : String.Empty
603 };
604 }
605 }
606}
diff --git a/src/test/WixToolsetTest.Converters.Symbolizer/TestData/Integration/test.wixout b/src/test/WixToolsetTest.Converters.Symbolizer/TestData/Integration/test.wixout
deleted file mode 100644
index da64b8af..00000000
--- a/src/test/WixToolsetTest.Converters.Symbolizer/TestData/Integration/test.wixout
+++ /dev/null
Binary files differ
diff --git a/src/test/WixToolsetTest.Converters.Symbolizer/TestData/Integration/test.wixproj b/src/test/WixToolsetTest.Converters.Symbolizer/TestData/Integration/test.wixproj
deleted file mode 100644
index d7c4e625..00000000
--- a/src/test/WixToolsetTest.Converters.Symbolizer/TestData/Integration/test.wixproj
+++ /dev/null
@@ -1,47 +0,0 @@
1<?xml version="1.0" encoding="utf-8"?>
2<Project ToolsVersion="4.0" DefaultTargets="Build" InitialTargets="EnsureWixToolsetInstalled" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 <PropertyGroup>
4 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5 <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
6 <ProductVersion>3.10</ProductVersion>
7 <ProjectGuid>d59f1c1e-9238-49fa-bfa2-ec1d9c2dda1d</ProjectGuid>
8 <SchemaVersion>2.0</SchemaVersion>
9 <OutputName>SymbolizerWixout</OutputName>
10 <OutputType>Package</OutputType>
11 </PropertyGroup>
12 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
13 <OutputPath>bin\$(Configuration)\</OutputPath>
14 <IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
15 <DefineConstants>Debug</DefineConstants>
16 </PropertyGroup>
17 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
18 <OutputPath>bin\$(Configuration)\</OutputPath>
19 <IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
20 </PropertyGroup>
21 <ItemGroup>
22 <Compile Include="Product.wxs" />
23 </ItemGroup>
24 <ItemGroup>
25 <WixExtension Include="WixUtilExtension">
26 <HintPath>$(WixExtDir)\WixUtilExtension.dll</HintPath>
27 <Name>WixUtilExtension</Name>
28 </WixExtension>
29 <WixExtension Include="WixNetFxExtension">
30 <HintPath>$(WixExtDir)\WixNetFxExtension.dll</HintPath>
31 <Name>WixNetFxExtension</Name>
32 </WixExtension>
33 </ItemGroup>
34 <Import Project="$(WixTargetsPath)" Condition=" '$(WixTargetsPath)' != '' " />
35 <Import Project="$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets" Condition=" '$(WixTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets') " />
36 <Target Name="EnsureWixToolsetInstalled" Condition=" '$(WixTargetsImported)' != 'true' ">
37 <Error Text="The WiX Toolset v3.11 (or newer) build tools must be installed to build this project. To download the WiX Toolset, see http://wixtoolset.org/releases/" />
38 </Target>
39 <!--
40 To modify your build process, add your task inside one of the targets below and uncomment it.
41 Other similar extension points exist, see Wix.targets.
42 <Target Name="BeforeBuild">
43 </Target>
44 <Target Name="AfterBuild">
45 </Target>
46 -->
47</Project> \ No newline at end of file
diff --git a/src/test/WixToolsetTest.Converters.Symbolizer/TestData/Integration/test.wxs b/src/test/WixToolsetTest.Converters.Symbolizer/TestData/Integration/test.wxs
deleted file mode 100644
index 46d4fb43..00000000
--- a/src/test/WixToolsetTest.Converters.Symbolizer/TestData/Integration/test.wxs
+++ /dev/null
@@ -1,36 +0,0 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
3 <Product Id="*" Name="SymbolizerWixout" Language="1033" Version="1.0.0.0" Manufacturer="FireGiant" UpgradeCode="14a02d7f-9b32-4c92-b1f1-da518bf4e32a">
4 <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
5
6 <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." AllowSameVersionUpgrades="yes" IgnoreRemoveFailure="yes" />
7 <MediaTemplate />
8
9 <Feature Id="ProductFeature" Title="SymbolizerWixout" Level="1">
10 <Feature Id="ChildFeature">
11 <ComponentGroupRef Id="ProductComponents" />
12 </Feature>
13 </Feature>
14
15 <PropertyRef Id="WIX_IS_NETFRAMEWORK_462_OR_LATER_INSTALLED" />
16 <CustomActionRef Id="WixFailWhenDeferred" />
17 <Property Id="WIXFAILWHENDEFERRED" Value="1" Secure="yes" />
18 </Product>
19
20 <Fragment>
21 <Directory Id="TARGETDIR" Name="SourceDir">
22 <Directory Id="ProgramFilesFolder">
23 <Directory Id="INSTALLFOLDER" Name="SymbolizerWixout" />
24 </Directory>
25 </Directory>
26 </Fragment>
27
28 <Fragment>
29 <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
30 <Component Id="ProductComponent">
31 <File Checksum="yes" ReadOnly="yes" Source="$(env.WIX)\bin\candle.exe" Assembly=".net" AssemblyApplication="candle.exe" />
32 <RegistryValue Root="HKLM" Key="SOFTWARE\WiX Toolset" Name="[ProductName]Installed" Value="1" Type="integer" />
33 </Component>
34 </ComponentGroup>
35 </Fragment>
36</Wix>
diff --git a/src/test/WixToolsetTest.Converters.Symbolizer/WixToolsetTest.Converters.Symbolizer.csproj b/src/test/WixToolsetTest.Converters.Symbolizer/WixToolsetTest.Converters.Symbolizer.csproj
deleted file mode 100644
index 995d9297..00000000
--- a/src/test/WixToolsetTest.Converters.Symbolizer/WixToolsetTest.Converters.Symbolizer.csproj
+++ /dev/null
@@ -1,33 +0,0 @@
1<?xml version="1.0" encoding="utf-8"?>
2<!-- 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. -->
3
4<Project Sdk="Microsoft.NET.Sdk">
5
6 <PropertyGroup>
7 <TargetFramework>net461</TargetFramework>
8 <IsPackable>false</IsPackable>
9 </PropertyGroup>
10
11 <ItemGroup>
12 <Content Include="TestData\**" CopyToOutputDirectory="PreserveNewest" />
13 </ItemGroup>
14
15 <ItemGroup>
16 <ProjectReference Include="..\..\WixToolset.Converters.Symbolizer\WixToolset.Converters.Symbolizer.csproj" />
17 </ItemGroup>
18
19 <ItemGroup>
20 <PackageReference Include="WixToolset.Data" Version="4.0.*" />
21 <PackageReference Include="WixBuildTools.TestSupport" Version="4.0.*" />
22 </ItemGroup>
23
24 <ItemGroup>
25 <Reference Include="wix" HintPath="..\..\deps\wix.dll" />
26 </ItemGroup>
27
28 <ItemGroup>
29 <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.1.0" />
30 <PackageReference Include="xunit" Version="2.4.1" />
31 <PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" PrivateAssets="All" />
32 </ItemGroup>
33</Project>
diff --git a/src/test/WixToolsetTest.Converters.Symbolizer/WixToolsetTest.Converters.Symbolizer.v3.ncrunchproject b/src/test/WixToolsetTest.Converters.Symbolizer/WixToolsetTest.Converters.Symbolizer.v3.ncrunchproject
deleted file mode 100644
index 18ab4f79..00000000
--- a/src/test/WixToolsetTest.Converters.Symbolizer/WixToolsetTest.Converters.Symbolizer.v3.ncrunchproject
+++ /dev/null
@@ -1,9 +0,0 @@
1<ProjectConfiguration>
2 <Settings>
3 <IgnoredTests>
4 <NamedTestSelector>
5 <TestName>WixToolsetTest.Converters.Symbolizer.ConvertSymbolsFixture.CanLoadWixoutAndConvertToIntermediate</TestName>
6 </NamedTestSelector>
7 </IgnoredTests>
8 </Settings>
9</ProjectConfiguration> \ No newline at end of file
diff --git a/src/test/WixToolsetTest.Converters/BaseConverterFixture.cs b/src/test/WixToolsetTest.Converters/BaseConverterFixture.cs
deleted file mode 100644
index 2421d73b..00000000
--- a/src/test/WixToolsetTest.Converters/BaseConverterFixture.cs
+++ /dev/null
@@ -1,33 +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
3namespace WixToolsetTest.Converters
4{
5 using System;
6 using System.IO;
7 using System.Text;
8 using System.Xml;
9 using System.Xml.Linq;
10 using Xunit;
11
12 public abstract class BaseConverterFixture
13 {
14 protected static string UnformattedDocumentString(XDocument document, bool omitXmlDeclaration = true)
15 {
16 var sb = new StringBuilder();
17
18 using (var writer = new StringWriter(sb))
19 using (var xml = XmlWriter.Create(writer, new XmlWriterSettings { OmitXmlDeclaration = omitXmlDeclaration }))
20 {
21 document.Save(xml);
22 }
23
24 return sb.ToString().TrimStart();
25 }
26
27 protected static string[] UnformattedDocumentLines(XDocument document, bool omitXmlDeclaration = true)
28 {
29 var unformatted = UnformattedDocumentString(document, omitXmlDeclaration);
30 return unformatted.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
31 }
32 }
33}
diff --git a/src/test/WixToolsetTest.Converters/BitnessFixture.cs b/src/test/WixToolsetTest.Converters/BitnessFixture.cs
deleted file mode 100644
index e45a9388..00000000
--- a/src/test/WixToolsetTest.Converters/BitnessFixture.cs
+++ /dev/null
@@ -1,187 +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
3namespace 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 BitnessFixture : BaseConverterFixture
13 {
14 [Fact]
15 public void FixComponentBitness()
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'>",
20 " <Fragment>",
21 " <Component>",
22 " <File Source='default.exe' />",
23 " </Component>",
24 " <Component Win64='no'>",
25 " <File Source='32bit.exe' />",
26 " </Component>",
27 " <Component Win64='yes'>",
28 " <File Source='64bit.exe' />",
29 " </Component>",
30 " <Component Win64='$(var.Win64)'>",
31 " <File Source='unconvert.exe' />",
32 " </Component>",
33 " </Fragment>",
34 "</Wix>");
35
36 var expected = new[]
37 {
38 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
39 " <Fragment>",
40 " <Component>",
41 " <File Id=\"default.exe\" Source=\"default.exe\" />",
42 " </Component>",
43 " <Component Bitness=\"always32\">",
44 " <File Id=\"_32bit.exe\" Source=\"32bit.exe\" />",
45 " </Component>",
46 " <Component Bitness=\"always64\">",
47 " <File Id=\"_64bit.exe\" Source=\"64bit.exe\" />",
48 " </Component>",
49 " <Component Bitness=\"$(var.Win64)\">",
50 " <File Id=\"unconvert.exe\" Source=\"unconvert.exe\" />",
51 " </Component>",
52 " </Fragment>",
53 "</Wix>"
54 };
55
56 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
57
58 var messaging = new MockMessaging();
59 var converter = new WixConverter(messaging, 2, null, null);
60
61 var errors = converter.ConvertDocument(document);
62 Assert.Equal(10, errors);
63
64 var actualLines = UnformattedDocumentLines(document);
65 WixAssert.CompareLineByLine(expected, actualLines);
66 }
67
68 [Fact]
69 public void FixRegistrySearchBitness()
70 {
71 var parse = String.Join(Environment.NewLine,
72 "<?xml version=\"1.0\" encoding=\"utf-16\"?>",
73 "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>",
74 " <Fragment>",
75 " <Property Id='BITNESSDEFAULT'>",
76 " <RegistrySearch Id='SampleRegSearch' Root='HKLM' Key='SampleReg' Type='raw'></RegistrySearch>",
77 " </Property>",
78 " <Property Id='BITNESS32'>",
79 " <RegistrySearch Id='SampleRegSearch' Root='HKLM' Key='SampleReg' Type='raw' Win64='no'></RegistrySearch>",
80 " </Property>",
81 " <Property Id='BITNESS64'>",
82 " <RegistrySearch Id='SampleRegSearch' Root='HKLM' Key='SampleReg' Type='raw' Win64='yes'></RegistrySearch>",
83 " </Property>",
84 " </Fragment>",
85 "</Wix>");
86
87 var expected = new[]
88 {
89 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
90 " <Fragment>",
91 " <Property Id=\"BITNESSDEFAULT\">",
92 " <RegistrySearch Id=\"SampleRegSearch\" Root=\"HKLM\" Key=\"SampleReg\" Type=\"raw\"></RegistrySearch>",
93 " </Property>",
94 " <Property Id=\"BITNESS32\">",
95 " <RegistrySearch Id=\"SampleRegSearch\" Root=\"HKLM\" Key=\"SampleReg\" Type=\"raw\" Bitness=\"always32\"></RegistrySearch>",
96 " </Property>",
97 " <Property Id=\"BITNESS64\">",
98 " <RegistrySearch Id=\"SampleRegSearch\" Root=\"HKLM\" Key=\"SampleReg\" Type=\"raw\" Bitness=\"always64\"></RegistrySearch>",
99 " </Property>",
100 " </Fragment>",
101 "</Wix>"
102 };
103
104 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
105
106 var messaging = new MockMessaging();
107 var converter = new WixConverter(messaging, 2, null, null);
108
109 var errors = converter.ConvertDocument(document);
110 Assert.Equal(4, errors);
111
112 var actualLines = UnformattedDocumentLines(document);
113 WixAssert.CompareLineByLine(expected, actualLines);
114 }
115
116 [Fact]
117 public void FixUtilRegistrySearchBitness()
118 {
119 var parse = String.Join(Environment.NewLine,
120 "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:util='http://schemas.microsoft.com/wix/UtilExtension'>",
121 " <Fragment>",
122 " <util:RegistrySearch Id='RegValue' Root='HKLM' Key='Converter' Variable='Test' />",
123 " <util:RegistrySearch Id='RegValue2' Root='HKLM' Key='Converter' Variable='Test' Result='value' Win64='no' />",
124 " <util:RegistrySearch Id='RegValue3' Root='HKLM' Key='Converter' Variable='Test' Result='exists' Win64='yes' />",
125 " </Fragment>",
126 "</Wix>");
127
128 var expected = new[]
129 {
130 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\" xmlns:util=\"http://wixtoolset.org/schemas/v4/wxs/util\">",
131 " <Fragment>",
132 " <util:RegistrySearch Id=\"RegValue\" Root=\"HKLM\" Key=\"Converter\" Variable=\"Test\" />",
133 " <util:RegistrySearch Id=\"RegValue2\" Root=\"HKLM\" Key=\"Converter\" Variable=\"Test\" Result=\"value\" Bitness=\"always32\" />",
134 " <util:RegistrySearch Id=\"RegValue3\" Root=\"HKLM\" Key=\"Converter\" Variable=\"Test\" Result=\"exists\" Bitness=\"always64\" />",
135 " </Fragment>",
136 "</Wix>"
137 };
138
139 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
140
141 var messaging = new MockMessaging();
142 var converter = new WixConverter(messaging, 2, null, null);
143
144 var errors = converter.ConvertDocument(document);
145 Assert.Equal(6, errors);
146
147 var actualLines = UnformattedDocumentLines(document);
148 WixAssert.CompareLineByLine(expected, actualLines);
149 }
150
151 [Fact]
152 public void FixApprovedExeBitness()
153 {
154 var parse = String.Join(Environment.NewLine,
155 "<?xml version=\"1.0\" encoding=\"utf-16\"?>",
156 "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>",
157 " <Bundle>",
158 " <ApprovedExeForElevation Id='Default' Key='WixToolset\\BurnTesting' Value='Test' />",
159 " <ApprovedExeForElevation Id='Bitness32' Key='WixToolset\\BurnTesting' Value='Test' Win64='no' />",
160 " <ApprovedExeForElevation Id='Bitness64' Key='WixToolset\\BurnTesting' Value='Test' Win64='yes' />",
161 " </Bundle>",
162 "</Wix>");
163
164 var expected = new[]
165 {
166 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
167 " <Bundle>",
168 " <ApprovedExeForElevation Id=\"Default\" Key=\"WixToolset\\BurnTesting\" Value=\"Test\" />",
169 " <ApprovedExeForElevation Id=\"Bitness32\" Key=\"WixToolset\\BurnTesting\" Value=\"Test\" Bitness=\"always32\" />",
170 " <ApprovedExeForElevation Id=\"Bitness64\" Key=\"WixToolset\\BurnTesting\" Value=\"Test\" Bitness=\"always64\" />",
171 " </Bundle>",
172 "</Wix>"
173 };
174
175 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
176
177 var messaging = new MockMessaging();
178 var converter = new WixConverter(messaging, 2, null, null);
179
180 var errors = converter.ConvertDocument(document);
181 Assert.Equal(4, errors);
182
183 var actualLines = UnformattedDocumentLines(document);
184 WixAssert.CompareLineByLine(expected, actualLines);
185 }
186 }
187}
diff --git a/src/test/WixToolsetTest.Converters/BootstrapperApplicationFixture.cs b/src/test/WixToolsetTest.Converters/BootstrapperApplicationFixture.cs
deleted file mode 100644
index 158ab3be..00000000
--- a/src/test/WixToolsetTest.Converters/BootstrapperApplicationFixture.cs
+++ /dev/null
@@ -1,418 +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
3namespace 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 BootstrapperApplicationFixture : BaseConverterFixture
13 {
14 [Fact]
15 public void CantCreateBootstrapperApplicationDllFromV3PayloadGroupRef()
16 {
17 var parse = String.Join(Environment.NewLine,
18 "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>",
19 " <Fragment>",
20 " <BootstrapperApplication Id='ba'>",
21 " <PayloadGroupRef Id='baPayloads' />",
22 " </BootstrapperApplication>",
23 " </Fragment>",
24 "</Wix>");
25
26 var expected = new[]
27 {
28 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
29 " <Fragment>",
30 " <BootstrapperApplication Id=\"ba\">",
31 " <PayloadGroupRef Id=\"baPayloads\" />",
32 " </BootstrapperApplication>",
33 " </Fragment>",
34 "</Wix>"
35 };
36
37 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
38
39 var messaging = new MockMessaging();
40 var converter = new WixConverter(messaging, 2, null, null);
41
42 var errors = converter.ConvertDocument(document);
43 Assert.Equal(2, errors);
44
45 var actualLines = UnformattedDocumentLines(document);
46 WixAssert.CompareLineByLine(expected, actualLines);
47 }
48
49 [Fact]
50 public void ConvertDotNetCoreBootstrapperApplicationRefWithExistingElement()
51 {
52 var parse = String.Join(Environment.NewLine,
53 "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs' xmlns:bal='http://wixtoolset.org/schemas/v4/wxs/bal'>",
54 " <Fragment>",
55 " <BootstrapperApplicationRef Id='DotNetCoreBootstrapperApplicationHost.Minimal'>",
56 " <bal:WixDotNetCoreBootstrapperApplication SelfContainedDeployment='yes' />",
57 " </BootstrapperApplicationRef>",
58 " </Fragment>",
59 "</Wix>");
60
61 var expected = new[]
62 {
63 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\" xmlns:bal=\"http://wixtoolset.org/schemas/v4/wxs/bal\">",
64 " <Fragment>",
65 " <BootstrapperApplication>",
66 " <bal:WixDotNetCoreBootstrapperApplicationHost SelfContainedDeployment=\"yes\" Theme=\"none\" />",
67 " </BootstrapperApplication>",
68 " </Fragment>",
69 "</Wix>"
70 };
71
72 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
73
74 var messaging = new MockMessaging();
75 var converter = new WixConverter(messaging, 2, null, null);
76
77 var errors = converter.ConvertDocument(document);
78 Assert.Equal(1, errors);
79
80 var actualLines = UnformattedDocumentLines(document);
81 WixAssert.CompareLineByLine(expected, actualLines);
82 }
83
84 [Fact]
85 public void ConvertDotNetCoreBootstrapperApplicationRefWithoutExistingElement()
86 {
87 var parse = String.Join(Environment.NewLine,
88 "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs' xmlns:bal='http://wixtoolset.org/schemas/v4/wxs/bal'>",
89 " <Fragment>",
90 " <BootstrapperApplicationRef Id='DotNetCoreBootstrapperApplicationHost' />",
91 " </Fragment>",
92 "</Wix>");
93
94 var expected = new[]
95 {
96 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\" xmlns:bal=\"http://wixtoolset.org/schemas/v4/wxs/bal\">",
97 " <Fragment>",
98 " <BootstrapperApplication>",
99 "<bal:WixDotNetCoreBootstrapperApplicationHost />",
100 "</BootstrapperApplication>",
101 " </Fragment>",
102 "</Wix>"
103 };
104
105 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
106
107 var messaging = new MockMessaging();
108 var converter = new WixConverter(messaging, 2, null, null);
109
110 var errors = converter.ConvertDocument(document);
111 Assert.Equal(1, errors);
112
113 var actualLines = UnformattedDocumentLines(document);
114 WixAssert.CompareLineByLine(expected, actualLines);
115 }
116
117 [Fact]
118 public void ConvertFrameworkBootstrapperApplicationRefWithExistingElement()
119 {
120 var parse = String.Join(Environment.NewLine,
121 "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:bal='http://schemas.microsoft.com/wix/BalExtension'>",
122 " <Fragment>",
123 " <BootstrapperApplicationRef Id='ManagedBootstrapperApplicationHost'>",
124 " <bal:WixManagedBootstrapperApplicationHost LogoFile='logo.png' />",
125 " </BootstrapperApplicationRef>",
126 " </Fragment>",
127 "</Wix>");
128
129 var expected = new[]
130 {
131 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\" xmlns:bal=\"http://wixtoolset.org/schemas/v4/wxs/bal\">",
132 " <Fragment>",
133 " <BootstrapperApplication>",
134 " <bal:WixManagedBootstrapperApplicationHost LogoFile=\"logo.png\" />",
135 " </BootstrapperApplication>",
136 " </Fragment>",
137 "</Wix>"
138 };
139
140 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
141
142 var messaging = new MockMessaging();
143 var converter = new WixConverter(messaging, 2, null, null);
144
145 var errors = converter.ConvertDocument(document);
146 Assert.Equal(3, errors);
147
148 var actualLines = UnformattedDocumentLines(document);
149 WixAssert.CompareLineByLine(expected, actualLines);
150 }
151
152 [Fact]
153 public void ConvertFrameworkBootstrapperApplicationRefWithoutExistingElement()
154 {
155 var parse = String.Join(Environment.NewLine,
156 "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:bal='http://schemas.microsoft.com/wix/BalExtension'>",
157 " <Fragment>",
158 " <BootstrapperApplicationRef Id='ManagedBootstrapperApplicationHost.RtfLicense.Minimal' />",
159 " </Fragment>",
160 "</Wix>");
161
162 var expected = new[]
163 {
164 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\" xmlns:bal=\"http://wixtoolset.org/schemas/v4/wxs/bal\">",
165 " <Fragment>",
166 " <BootstrapperApplication>",
167 "<bal:WixManagedBootstrapperApplicationHost Theme=\"none\" />",
168 "</BootstrapperApplication>",
169 " </Fragment>",
170 "</Wix>"
171 };
172
173 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
174
175 var messaging = new MockMessaging();
176 var converter = new WixConverter(messaging, 2, null, null);
177
178 var errors = converter.ConvertDocument(document);
179 Assert.Equal(3, errors);
180
181 var actualLines = UnformattedDocumentLines(document);
182 WixAssert.CompareLineByLine(expected, actualLines);
183 }
184
185 [Fact]
186 public void ConvertStandardBootstrapperApplicationRefWithExistingElement()
187 {
188 var parse = String.Join(Environment.NewLine,
189 "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:bal='http://schemas.microsoft.com/wix/BalExtension'>",
190 " <Fragment>",
191 " <BootstrapperApplicationRef Id='WixStandardBootstrapperApplication.Foundation'>",
192 " <bal:WixStandardBootstrapperApplication LaunchTarget='[InstallFolder]the.exe' />",
193 " </BootstrapperApplicationRef>",
194 " </Fragment>",
195 "</Wix>");
196
197 var expected = new[]
198 {
199 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\" xmlns:bal=\"http://wixtoolset.org/schemas/v4/wxs/bal\">",
200 " <Fragment>",
201 " <BootstrapperApplication>",
202 " <bal:WixStandardBootstrapperApplication LaunchTarget=\"[InstallFolder]the.exe\" Theme=\"none\" />",
203 " </BootstrapperApplication>",
204 " </Fragment>",
205 "</Wix>"
206 };
207
208 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
209
210 var messaging = new MockMessaging();
211 var converter = new WixConverter(messaging, 2, null, null);
212
213 var errors = converter.ConvertDocument(document);
214 Assert.Equal(3, errors);
215
216 var actualLines = UnformattedDocumentLines(document);
217 WixAssert.CompareLineByLine(expected, actualLines);
218 }
219
220 [Fact]
221 public void ConvertStandardBootstrapperApplicationRefWithoutExistingElement()
222 {
223 var parse = String.Join(Environment.NewLine,
224 "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:bal='http://schemas.microsoft.com/wix/BalExtension'>",
225 " <Fragment>",
226 " <BootstrapperApplicationRef Id='WixStandardBootstrapperApplication.RtfLicense' />",
227 " </Fragment>",
228 "</Wix>");
229
230 var expected = new[]
231 {
232 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\" xmlns:bal=\"http://wixtoolset.org/schemas/v4/wxs/bal\">",
233 " <Fragment>",
234 " <BootstrapperApplication>",
235 "<bal:WixStandardBootstrapperApplication Theme=\"rtfLicense\" />",
236 "</BootstrapperApplication>",
237 " </Fragment>",
238 "</Wix>"
239 };
240
241 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
242
243 var messaging = new MockMessaging();
244 var converter = new WixConverter(messaging, 2, null, null);
245
246 var errors = converter.ConvertDocument(document);
247 Assert.Equal(3, errors);
248
249 var actualLines = UnformattedDocumentLines(document);
250 WixAssert.CompareLineByLine(expected, actualLines);
251 }
252
253 [Fact]
254 public void CreateBootstrapperApplicationDllFromV3()
255 {
256 var parse = String.Join(Environment.NewLine,
257 "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>",
258 " <Fragment>",
259 " <BootstrapperApplication Id='ba' SourceFile='ba.dll' />",
260 " </Fragment>",
261 "</Wix>");
262
263 var expected = new[]
264 {
265 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
266 " <Fragment>",
267 " <BootstrapperApplication Id=\"ba\">",
268 "<BootstrapperApplicationDll SourceFile=\"ba.dll\" DpiAwareness=\"unaware\" />",
269 "</BootstrapperApplication>",
270 " </Fragment>",
271 "</Wix>"
272 };
273
274 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
275
276 var messaging = new MockMessaging();
277 var converter = new WixConverter(messaging, 2, null, null);
278
279 var errors = converter.ConvertDocument(document);
280 Assert.Equal(3, errors);
281
282 var actualLines = UnformattedDocumentLines(document);
283 WixAssert.CompareLineByLine(expected, actualLines);
284 }
285
286 [Fact]
287 public void CreateBootstrapperApplicationDllFromV3Payload()
288 {
289 var parse = String.Join(Environment.NewLine,
290 "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>",
291 " <Fragment>",
292 " <BootstrapperApplication Id='ba'>",
293 " <Payload SourceFile='ba.dll' />",
294 " </BootstrapperApplication>",
295 " </Fragment>",
296 "</Wix>");
297
298 var expected = new[]
299 {
300 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
301 " <Fragment>",
302 " <BootstrapperApplication Id=\"ba\">",
303 " ",
304 " ",
305 "<BootstrapperApplicationDll SourceFile=\"ba.dll\" DpiAwareness=\"unaware\" />",
306 "</BootstrapperApplication>",
307 " </Fragment>",
308 "</Wix>"
309 };
310
311 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
312
313 var messaging = new MockMessaging();
314 var converter = new WixConverter(messaging, 2, null, null);
315
316 var errors = converter.ConvertDocument(document);
317 Assert.Equal(3, errors);
318
319 var actualLines = UnformattedDocumentLines(document);
320 WixAssert.CompareLineByLine(expected, actualLines);
321 }
322
323 [Fact]
324 public void DoesntSetDpiUnawareFromV4()
325 {
326 var parse = String.Join(Environment.NewLine,
327 "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>",
328 " <Fragment>",
329 " <BootstrapperApplication Id='ba' />",
330 " </Fragment>",
331 "</Wix>");
332
333 var expected = new[]
334 {
335 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
336 " <Fragment>",
337 " <BootstrapperApplication Id=\"ba\" />",
338 " </Fragment>",
339 "</Wix>"
340 };
341
342 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
343
344 var messaging = new MockMessaging();
345 var converter = new WixConverter(messaging, 2, null, null);
346
347 var errors = converter.ConvertDocument(document);
348 Assert.Equal(0, errors);
349
350 var actualLines = UnformattedDocumentLines(document);
351 WixAssert.CompareLineByLine(expected, actualLines);
352 }
353
354 [Fact]
355 public void KeepsDpiAwarenessFromV4()
356 {
357 var parse = String.Join(Environment.NewLine,
358 "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>",
359 " <Fragment>",
360 " <BootstrapperApplication Id='ba' SourceFile='ba.dll' DpiAwareness='system' />",
361 " </Fragment>",
362 "</Wix>");
363
364 var expected = new[]
365 {
366 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
367 " <Fragment>",
368 " <BootstrapperApplication Id=\"ba\">",
369 "<BootstrapperApplicationDll SourceFile=\"ba.dll\" DpiAwareness=\"system\" />",
370 "</BootstrapperApplication>",
371 " </Fragment>",
372 "</Wix>"
373 };
374
375 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
376
377 var messaging = new MockMessaging();
378 var converter = new WixConverter(messaging, 2, null, null);
379
380 var errors = converter.ConvertDocument(document);
381 Assert.Equal(1, errors);
382
383 var actualLines = UnformattedDocumentLines(document);
384 WixAssert.CompareLineByLine(expected, actualLines);
385 }
386
387 [Fact]
388 public void RemovesBalUseUILanguages()
389 {
390 var parse = String.Join(Environment.NewLine,
391 "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:bal='http://schemas.microsoft.com/wix/BalExtension'>",
392 " <Fragment>",
393 " <BootstrapperApplication Id='ba' bal:UseUILanguages='true' />",
394 " </Fragment>",
395 "</Wix>");
396
397 var expected = new[]
398 {
399 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
400 " <Fragment>",
401 " <BootstrapperApplication Id=\"ba\" />",
402 " </Fragment>",
403 "</Wix>"
404 };
405
406 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
407
408 var messaging = new MockMessaging();
409 var converter = new WixConverter(messaging, 2, null, null);
410
411 var errors = converter.ConvertDocument(document);
412 Assert.Equal(5, errors);
413
414 var actualLines = UnformattedDocumentLines(document);
415 WixAssert.CompareLineByLine(expected, actualLines);
416 }
417 }
418}
diff --git a/src/test/WixToolsetTest.Converters/ConditionFixture.cs b/src/test/WixToolsetTest.Converters/ConditionFixture.cs
deleted file mode 100644
index d3f65aeb..00000000
--- a/src/test/WixToolsetTest.Converters/ConditionFixture.cs
+++ /dev/null
@@ -1,297 +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
3namespace 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 ConditionFixture : BaseConverterFixture
13 {
14 [Fact]
15 public void FixControlCondition()
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'>",
20 " <Fragment>",
21 " <UI>",
22 " <Dialog Id='Dlg1'>",
23 " <Control Id='Control1'>",
24 " <Condition Action='disable'>x=y</Condition>",
25 " <Condition Action='hide'>a&lt;>b</Condition>",
26 " </Control>",
27 " </Dialog>",
28 " </UI>",
29 " </Fragment>",
30 "</Wix>");
31
32 var expected = new[]
33 {
34 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
35 " <Fragment>",
36 " <UI>",
37 " <Dialog Id=\"Dlg1\">",
38 " <Control Id=\"Control1\" DisableCondition=\"x=y\" HideCondition=\"a&lt;&gt;b\">",
39 " ",
40 " ",
41 " </Control>",
42 " </Dialog>",
43 " </UI>",
44 " </Fragment>",
45 "</Wix>"
46 };
47
48 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
49
50 var messaging = new MockMessaging();
51 var converter = new WixConverter(messaging, 2, null, null);
52
53 var errors = converter.ConvertDocument(document);
54 Assert.Equal(4, errors);
55
56 var actualLines = UnformattedDocumentLines(document);
57 WixAssert.CompareLineByLine(expected, actualLines);
58 }
59
60 [Fact]
61 public void FixPublishCondition()
62 {
63 var parse = String.Join(Environment.NewLine,
64 "<?xml version=\"1.0\" encoding=\"utf-16\"?>",
65 "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>",
66 " <Fragment>",
67 " <UI>",
68 " <Dialog Id='Dlg1'>",
69 " <Control Id='Control1'>",
70 " <Publish Value='abc'>1&lt;2</Publish>",
71 " <Publish Value='gone'>1</Publish>",
72 " </Control>",
73 " </Dialog>",
74 " </UI>",
75 " </Fragment>",
76 "</Wix>");
77
78 var expected = new[]
79 {
80 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
81 " <Fragment>",
82 " <UI>",
83 " <Dialog Id=\"Dlg1\">",
84 " <Control Id=\"Control1\">",
85 " <Publish Value=\"abc\" Condition=\"1&lt;2\" />",
86 " <Publish Value=\"gone\" />",
87 " </Control>",
88 " </Dialog>",
89 " </UI>",
90 " </Fragment>",
91 "</Wix>"
92 };
93
94 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
95
96 var messaging = new MockMessaging();
97 var converter = new WixConverter(messaging, 2, null, null);
98
99 var errors = converter.ConvertDocument(document);
100 Assert.Equal(5, errors);
101
102 var actualLines = UnformattedDocumentLines(document);
103 WixAssert.CompareLineByLine(expected, actualLines);
104 }
105
106 [Fact]
107 public void FixComponentCondition()
108 {
109 var parse = String.Join(Environment.NewLine,
110 "<?xml version=\"1.0\" encoding=\"utf-16\"?>",
111 "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>",
112 " <Fragment>",
113 " <Component Id='Comp1' Directory='ApplicationFolder'>",
114 " <Condition>1&lt;2</Condition>",
115 " </Component>",
116 " </Fragment>",
117 "</Wix>");
118
119 var expected = new[]
120 {
121 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
122 " <Fragment>",
123 " <Component Id=\"Comp1\" Directory=\"ApplicationFolder\" Condition=\"1&lt;2\">",
124 " ",
125 " </Component>",
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(3, errors);
137
138 var actualLines = UnformattedDocumentLines(document);
139 WixAssert.CompareLineByLine(expected, actualLines);
140 }
141
142 [Fact]
143 public void FixFeatureCondition()
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'>",
148 " <Fragment>",
149 " <Feature Id='Feature1'>",
150 " <Condition Level='0'>PROP = 1</Condition>",
151 " </Feature>",
152 " </Fragment>",
153 "</Wix>");
154
155 var expected = new[]
156 {
157 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
158 " <Fragment>",
159 " <Feature Id=\"Feature1\">",
160 " <Level Value=\"0\" Condition=\"PROP = 1\" />",
161 " </Feature>",
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(3, errors);
173
174 var actualLines = UnformattedDocumentLines(document);
175 WixAssert.CompareLineByLine(expected, actualLines);
176 }
177
178 [Fact]
179 public void FixLaunchCondition()
180 {
181 var parse = String.Join(Environment.NewLine,
182 "<?xml version=\"1.0\" encoding=\"utf-16\"?>",
183 "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>",
184 " <Fragment>",
185 " <Condition Message='Stop the install'>",
186 " 1&lt;2",
187 " </Condition>",
188 " <Condition Message='Do not stop'>",
189 " 1=2",
190 " </Condition>",
191 " </Fragment>",
192 "</Wix>");
193
194 var expected = new[]
195 {
196 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
197 " <Fragment>",
198 " <Launch Condition=\"1&lt;2\" Message=\"Stop the install\" />",
199 " <Launch Condition=\"1=2\" Message=\"Do not stop\" />",
200 " </Fragment>",
201 "</Wix>"
202 };
203
204 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
205
206 var messaging = new MockMessaging();
207 var converter = new WixConverter(messaging, 2, null, null);
208
209 var errors = converter.ConvertDocument(document);
210 Assert.Equal(4, errors);
211
212 var actualLines = UnformattedDocumentLines(document);
213 WixAssert.CompareLineByLine(expected, actualLines);
214 }
215
216 [Fact]
217 public void FixLaunchConditionInProduct()
218 {
219 var parse = String.Join(Environment.NewLine,
220 "<?xml version=\"1.0\" encoding=\"utf-16\"?>",
221 "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>",
222 " <Product>",
223 " <Package />",
224 " <Condition Message='Stop the install'>",
225 " 1&lt;2",
226 " </Condition>",
227 " <Condition Message='Do not stop'>",
228 " 1=2",
229 " </Condition>",
230 " </Product>",
231 "</Wix>");
232
233 var expected = new[]
234 {
235 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
236 " <Package Compressed=\"no\">",
237 " ",
238 " <Launch Condition=\"1&lt;2\" Message=\"Stop the install\" />",
239 " <Launch Condition=\"1=2\" Message=\"Do not stop\" />",
240 " </Package>",
241 "</Wix>"
242 };
243
244 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
245
246 var messaging = new MockMessaging();
247 var converter = new WixConverter(messaging, 2, null, null);
248
249 var errors = converter.ConvertDocument(document);
250 Assert.Equal(6, errors);
251
252 var actualLines = UnformattedDocumentLines(document);
253 WixAssert.CompareLineByLine(expected, actualLines);
254 }
255
256 [Fact]
257 public void FixPermissionExCondition()
258 {
259 var parse = String.Join(Environment.NewLine,
260 "<!-- comment -->",
261 "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>",
262 " <Fragment>",
263 " <Component Id='Comp1' Guid='*' Directory='ApplicationFolder'>",
264 " <PermissionEx Sddl='sddl'>",
265 " <Condition>1&lt;2</Condition>",
266 " </PermissionEx>",
267 " </Component>",
268 " </Fragment>",
269 "</Wix>");
270
271 var expected = new[]
272 {
273 "<!-- comment -->",
274 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
275 " <Fragment>",
276 " <Component Id=\"Comp1\" Directory=\"ApplicationFolder\">",
277 " <PermissionEx Sddl=\"sddl\" Condition=\"1&lt;2\">",
278 " ",
279 " </PermissionEx>",
280 " </Component>",
281 " </Fragment>",
282 "</Wix>"
283 };
284
285 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
286
287 var messaging = new MockMessaging();
288 var converter = new WixConverter(messaging, 2, null, null);
289
290 var errors = converter.ConvertDocument(document);
291 Assert.Equal(3, errors);
292
293 var actualLines = UnformattedDocumentLines(document);
294 WixAssert.CompareLineByLine(expected, actualLines);
295 }
296 }
297}
diff --git a/src/test/WixToolsetTest.Converters/ConverterFixture.cs b/src/test/WixToolsetTest.Converters/ConverterFixture.cs
deleted file mode 100644
index 13df9da7..00000000
--- a/src/test/WixToolsetTest.Converters/ConverterFixture.cs
+++ /dev/null
@@ -1,449 +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
3namespace 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 ConverterFixture : BaseConverterFixture
12 {
13 private static readonly XNamespace Wix4Namespace = "http://wixtoolset.org/schemas/v4/wxs";
14
15 [Fact]
16 public void EnsuresNoDeclaration()
17 {
18 var parse = String.Join(Environment.NewLine,
19 "<?xml version='1.0' encoding='utf-8'?>",
20 "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>",
21 " <Fragment />",
22 "</Wix>");
23
24 var expected = String.Join(Environment.NewLine,
25 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
26 " <Fragment />",
27 "</Wix>");
28
29 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
30
31 var messaging = new MockMessaging();
32 var converter = new WixConverter(messaging, 2, null, null);
33
34 var errors = converter.ConvertDocument(document);
35
36 var actual = UnformattedDocumentString(document);
37
38 Assert.Equal(1, errors);
39 Assert.Equal(expected, actual);
40 }
41
42 [Fact]
43 public void EnsuresDeclarationWhenIgnored()
44 {
45 var parse = String.Join(Environment.NewLine,
46 "<?xml version='1.0' encoding='utf-16'?>",
47 "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>",
48 " <Fragment />",
49 "</Wix>");
50
51 var expected = String.Join(Environment.NewLine,
52 "<?xml version=\"1.0\" encoding=\"utf-16\"?>",
53 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
54 " <Fragment />",
55 "</Wix>");
56
57 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
58
59 var messaging = new MockMessaging();
60 var converter = new WixConverter(messaging, 2, ignoreErrors: new[] { "DeclarationPresent" } );
61
62 var errors = converter.ConvertDocument(document);
63
64 var actual = UnformattedDocumentString(document, omitXmlDeclaration: false);
65
66 Assert.Equal(0, errors);
67 Assert.Equal(expected, actual);
68 }
69
70 [Fact]
71 public void CanConvertMainNamespace()
72 {
73 var parse = String.Join(Environment.NewLine,
74 "<?xml version='1.0' encoding='utf-8'?>",
75 "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>",
76 " <Fragment />",
77 "</Wix>");
78
79 var expected = String.Join(Environment.NewLine,
80 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
81 " <Fragment />",
82 "</Wix>");
83
84 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
85
86 var messaging = new MockMessaging();
87 var converter = new WixConverter(messaging, 2, null, null);
88
89 var errors = converter.ConvertDocument(document);
90
91 var actual = UnformattedDocumentString(document);
92
93 Assert.Equal(2, errors);
94 //Assert.Equal(Wix4Namespace, document.Root.GetDefaultNamespace());
95 Assert.Equal(expected, actual);
96 }
97
98 [Fact]
99 public void CanConvertNamedMainNamespace()
100 {
101 var parse = String.Join(Environment.NewLine,
102 "<?xml version='1.0' encoding='utf-8'?>",
103 "<w:Wix xmlns:w='http://schemas.microsoft.com/wix/2006/wi'>",
104 " <w:Fragment />",
105 "</w:Wix>");
106
107 var expected = String.Join(Environment.NewLine,
108 "<w:Wix xmlns:w=\"http://wixtoolset.org/schemas/v4/wxs\">",
109 " <w:Fragment />",
110 "</w:Wix>");
111
112 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
113
114 var messaging = new MockMessaging();
115 var converter = new WixConverter(messaging, 2, null, null);
116
117 var errors = converter.ConvertDocument(document);
118
119 var actual = UnformattedDocumentString(document);
120
121 Assert.Equal(2, errors);
122 Assert.Equal(expected, actual);
123 Assert.Equal(Wix4Namespace, document.Root.GetNamespaceOfPrefix("w"));
124 }
125
126 [Fact]
127 public void CanConvertNonWixDefaultNamespace()
128 {
129 var parse = String.Join(Environment.NewLine,
130 "<?xml version='1.0' encoding='utf-8'?>",
131 "<w:Wix xmlns:w='http://schemas.microsoft.com/wix/2006/wi' xmlns='http://schemas.microsoft.com/wix/UtilExtension'>",
132 " <w:Fragment>",
133 " <Test />",
134 " </w:Fragment>",
135 "</w:Wix>");
136
137 var expected = String.Join(Environment.NewLine,
138 "<w:Wix xmlns:w=\"http://wixtoolset.org/schemas/v4/wxs\" xmlns=\"http://wixtoolset.org/schemas/v4/wxs/util\">",
139 " <w:Fragment>",
140 " <Test />",
141 " </w:Fragment>",
142 "</w:Wix>");
143
144 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
145
146 var messaging = new MockMessaging();
147 var converter = new WixConverter(messaging, 2, null, null);
148
149 var errors = converter.ConvertDocument(document);
150
151 var actual = UnformattedDocumentString(document);
152
153 Assert.Equal(expected, actual);
154 Assert.Equal(3, errors);
155 Assert.Equal(Wix4Namespace, document.Root.GetNamespaceOfPrefix("w"));
156 Assert.Equal("http://wixtoolset.org/schemas/v4/wxs/util", document.Root.GetDefaultNamespace());
157 }
158
159 [Fact]
160 public void CanRemoveUnusedNamespaces()
161 {
162 var parse = String.Join(Environment.NewLine,
163 "<?xml version='1.0' encoding='utf-8'?>",
164 "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:util='http://schemas.microsoft.com/wix/UtilExtension'>",
165 " <Fragment />",
166 "</Wix>");
167
168 var expected = String.Join(Environment.NewLine,
169 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
170 " <Fragment />",
171 "</Wix>");
172
173 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
174
175 var messaging = new MockMessaging();
176 var converter = new WixConverter(messaging, 2, null, null);
177
178 var errors = converter.ConvertDocument(document);
179
180 var actual = UnformattedDocumentString(document);
181
182 Assert.Equal(4, errors);
183 Assert.Equal(expected, actual);
184 Assert.Equal(Wix4Namespace, document.Root.GetDefaultNamespace());
185 }
186
187 [Fact]
188 public void CanConvertMissingWixNamespace()
189 {
190 var parse = String.Join(Environment.NewLine,
191 "<?xml version='1.0' encoding='utf-8'?>",
192 "<Wix>",
193 " <Fragment />",
194 "</Wix>");
195
196 var expected = String.Join(Environment.NewLine,
197 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
198 " <Fragment />",
199 "</Wix>");
200
201 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
202
203 var messaging = new MockMessaging();
204 var converter = new WixConverter(messaging, 2, null, null);
205
206 var errors = converter.ConvertDocument(document);
207
208 var actual = UnformattedDocumentString(document);
209
210 Assert.Equal(2, errors);
211 Assert.Equal(expected, actual);
212 Assert.Equal(Wix4Namespace, document.Root.GetDefaultNamespace());
213 }
214
215 [Fact]
216 public void CanConvertMissingIncludeNamespace()
217 {
218 var parse = String.Join(Environment.NewLine,
219 "<?xml version='1.0' encoding='utf-8'?>",
220 "<Include>",
221 " <?define Version = 1.2.3 ?>",
222 " <Fragment>",
223 " <DirectoryRef Id='TARGETDIR'>",
224 " <Directory Id='ANOTHERDIR' Name='Another' />",
225 " </DirectoryRef>",
226 " </Fragment>",
227 "</Include>");
228
229 var expected = String.Join(Environment.NewLine,
230 "<Include xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
231 " <?define Version = 1.2.3 ?>",
232 " <Fragment>",
233 " <DirectoryRef Id=\"TARGETDIR\">",
234 " <Directory Id=\"ANOTHERDIR\" Name=\"Another\" />",
235 " </DirectoryRef>",
236 " </Fragment>",
237 "</Include>");
238
239 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
240
241 var messaging = new MockMessaging();
242 var converter = new WixConverter(messaging, 2, null, null);
243
244 var errors = converter.ConvertDocument(document);
245
246 var actual = UnformattedDocumentString(document);
247
248 Assert.Equal(2, errors);
249 Assert.Equal(expected, actual);
250 Assert.Equal(Wix4Namespace, document.Root.GetDefaultNamespace());
251 }
252
253 [Fact]
254 public void CanConvertAnonymousFile()
255 {
256 var parse = String.Join(Environment.NewLine,
257 "<?xml version='1.0' encoding='utf-8'?>",
258 "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>",
259 " <File Source='path\\to\\foo.txt' />",
260 "</Wix>");
261
262 var expected = String.Join(Environment.NewLine,
263 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
264 " <File Id=\"foo.txt\" Source=\"path\\to\\foo.txt\" />",
265 "</Wix>");
266
267 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
268
269 var messaging = new MockMessaging();
270 var converter = new WixConverter(messaging, 2, null, null);
271
272 var errors = converter.ConvertDocument(document);
273
274 var actual = UnformattedDocumentString(document);
275
276 Assert.Equal(3, errors);
277 Assert.Equal(expected, actual);
278 }
279
280 [Fact]
281 public void CanConvertShortNameDirectoryWithoutName()
282 {
283 var parse = String.Join(Environment.NewLine,
284 "<?xml version='1.0' encoding='utf-8'?>",
285 "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>",
286 " <Directory ShortName='iamshort' />",
287 "</Wix>");
288
289 var expected = String.Join(Environment.NewLine,
290 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
291 " <Directory Name=\"iamshort\" />",
292 "</Wix>");
293
294 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
295
296 var messaging = new MockMessaging();
297 var converter = new WixConverter(messaging, 2, null, null);
298
299 var errors = converter.ConvertDocument(document);
300
301 var actual = UnformattedDocumentString(document);
302
303 Assert.Equal(2, errors);
304 Assert.Equal(expected, actual);
305 }
306
307 [Fact]
308 public void CanConvertCatalogElement()
309 {
310 var parse = String.Join(Environment.NewLine,
311 "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>",
312 " <Catalog Id='idCatalog' SourceFile='path\\to\\catalog.cat' />",
313 "</Wix>");
314
315 var expected = String.Join(Environment.NewLine,
316 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
317 " ",
318 "</Wix>");
319
320 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
321
322 var messaging = new MockMessaging();
323 var converter = new WixConverter(messaging, 2, null, null);
324
325 var errors = converter.ConvertDocument(document);
326
327 var actual = UnformattedDocumentString(document);
328
329 Assert.Equal(1, errors);
330 Assert.Equal(expected, actual);
331 }
332
333 [Fact]
334 public void CanConvertSuppressSignatureValidationNo()
335 {
336 var parse = String.Join(Environment.NewLine,
337 "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>",
338 " <MsiPackage SuppressSignatureValidation='no' />",
339 "</Wix>");
340
341 var expected = String.Join(Environment.NewLine,
342 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
343 " <MsiPackage />",
344 "</Wix>");
345
346 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
347
348 var messaging = new MockMessaging();
349 var converter = new WixConverter(messaging, 2, null, null);
350
351 var errors = converter.ConvertDocument(document);
352
353 var actual = UnformattedDocumentString(document);
354
355 Assert.Equal(1, errors);
356 Assert.Equal(expected, actual);
357 }
358
359 [Fact]
360 public void CanConvertSuppressSignatureValidationYes()
361 {
362 var parse = String.Join(Environment.NewLine,
363 "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>",
364 " <Payload SuppressSignatureValidation='yes' />",
365 "</Wix>");
366
367 var expected = String.Join(Environment.NewLine,
368 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
369 " <Payload />",
370 "</Wix>");
371
372 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
373
374 var messaging = new MockMessaging();
375 var converter = new WixConverter(messaging, 2, null, null);
376
377 var errors = converter.ConvertDocument(document);
378
379 var actual = UnformattedDocumentString(document);
380
381 Assert.Equal(1, errors);
382 Assert.Equal(expected, actual);
383 }
384
385 [Fact]
386 public void CantConvertVerbTarget()
387 {
388 var parse = String.Join(Environment.NewLine,
389 "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>",
390 " <Verb Target='anything' />",
391 "</Wix>");
392
393 var expected = String.Join(Environment.NewLine,
394 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
395 " <Verb Target=\"anything\" />",
396 "</Wix>");
397
398 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
399
400 var messaging = new MockMessaging();
401 var converter = new WixConverter(messaging, 2, null, null);
402
403 var errors = converter.ConvertDocument(document);
404
405 var actual = UnformattedDocumentString(document);
406
407 Assert.Equal(2, errors);
408 Assert.Equal(expected, actual);
409 }
410
411 [Fact]
412 public void CanConvertDeprecatedPrefix()
413 {
414 var parse = String.Join(Environment.NewLine,
415 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
416 "<Fragment>",
417 "<ComponentGroup Id=\"$(loc.Variable)\" />",
418 "<ComponentGroup Id=\"$$(loc.Variable)\" />",
419 "<ComponentGroup Id=\"$$$(loc.Variable)\" />",
420 "<ComponentGroup Id=\"$$$$(loc.Variable)\" />",
421 "<ComponentGroup Id=\"$$$$$(loc.Variable)\" />",
422 "</Fragment>",
423 "</Wix>");
424
425 var expected = String.Join(Environment.NewLine,
426 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
427 "<Fragment>",
428 "<ComponentGroup Id=\"!(loc.Variable)\" />",
429 "<ComponentGroup Id=\"$$(loc.Variable)\" />",
430 "<ComponentGroup Id=\"$$!(loc.Variable)\" />",
431 "<ComponentGroup Id=\"$$$$(loc.Variable)\" />",
432 "<ComponentGroup Id=\"$$$$!(loc.Variable)\" />",
433 "</Fragment>",
434 "</Wix>");
435
436 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
437
438 var messaging = new MockMessaging();
439 var converter = new WixConverter(messaging, 2, null, null);
440
441 var errors = converter.ConvertDocument(document);
442
443 var actual = UnformattedDocumentString(document);
444
445 Assert.Equal(3, errors);
446 Assert.Equal(expected, actual);
447 }
448 }
449}
diff --git a/src/test/WixToolsetTest.Converters/ConverterIntegrationFixture.cs b/src/test/WixToolsetTest.Converters/ConverterIntegrationFixture.cs
deleted file mode 100644
index a39f6243..00000000
--- a/src/test/WixToolsetTest.Converters/ConverterIntegrationFixture.cs
+++ /dev/null
@@ -1,195 +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
3namespace WixToolsetTest.Converters
4{
5 using System;
6 using System.IO;
7 using System.Linq;
8 using WixBuildTools.TestSupport;
9 using WixToolset.Converters;
10 using WixToolset.Core;
11 using WixToolset.Core.TestPackage;
12 using WixToolsetTest.Converters.Mocks;
13 using Xunit;
14
15 public class ConverterIntegrationFixture
16 {
17 [Fact]
18 public void CanConvertPermissionExFile()
19 {
20 const string beforeFileName = "v3.wxs";
21 const string afterFileName = "v4_expected.wxs";
22 var folder = TestData.Get(@"TestData\PermissionEx");
23
24 using (var fs = new DisposableFileSystem())
25 {
26 var baseFolder = fs.GetFolder(true);
27 var targetFile = Path.Combine(baseFolder, beforeFileName);
28 File.Copy(Path.Combine(folder, beforeFileName), Path.Combine(baseFolder, beforeFileName));
29
30 var messaging = new MockMessaging();
31 var converter = new WixConverter(messaging, 4);
32 var errors = converter.ConvertFile(targetFile, true);
33
34 Assert.Equal(8, errors);
35
36 var expected = File.ReadAllText(Path.Combine(folder, afterFileName)).Replace("\r\n", "\n");
37 var actual = File.ReadAllText(targetFile).Replace("\r\n", "\n");
38 Assert.Equal(expected, actual);
39
40 EnsureFixed(targetFile);
41 }
42 }
43
44 [Fact]
45 public void CanConvertSingleFile()
46 {
47 const string beforeFileName = "SingleFile.wxs";
48 const string afterFileName = "ConvertedSingleFile.wxs";
49 var folder = TestData.Get(@"TestData\SingleFile");
50
51 using (var fs = new DisposableFileSystem())
52 {
53 var baseFolder = fs.GetFolder(true);
54 var targetFile = Path.Combine(baseFolder, beforeFileName);
55 File.Copy(Path.Combine(folder, beforeFileName), Path.Combine(baseFolder, beforeFileName));
56
57 var messaging = new MockMessaging();
58 var converter = new WixConverter(messaging, 4);
59 var errors = converter.ConvertFile(targetFile, true);
60
61 Assert.Equal(9, errors);
62
63 var expected = File.ReadAllText(Path.Combine(folder, afterFileName)).Replace("\r\n", "\n");
64 var actual = File.ReadAllText(targetFile).Replace("\r\n", "\n");
65 Assert.Equal(expected, actual);
66
67 EnsureFixed(targetFile);
68 }
69 }
70
71 [Fact]
72 public void CanDetectReadOnlyOutputFile()
73 {
74 const string beforeFileName = "SingleFile.wxs";
75 var folder = TestData.Get(@"TestData\SingleFile");
76
77 using (var fs = new DisposableFileSystem())
78 {
79 var baseFolder = fs.GetFolder(true);
80 var targetFile = Path.Combine(baseFolder, beforeFileName);
81 File.Copy(Path.Combine(folder, beforeFileName), Path.Combine(baseFolder, beforeFileName));
82
83 var info = new FileInfo(targetFile);
84 info.IsReadOnly = true;
85
86 var messaging = new MockMessaging();
87 var converter = new WixConverter(messaging, 4);
88 var errors = converter.ConvertFile(targetFile, true);
89
90 Assert.Single(messaging.Messages.Where(m => m.Id == 5/*WixConverter.ConverterTestType.UnauthorizedAccessException*/));
91 }
92 }
93
94 [Fact]
95 public void RetainsPreprocessorInstructions()
96 {
97 const string beforeFileName = "Preprocessor.wxs";
98 const string afterFileName = "ConvertedPreprocessor.wxs";
99 var folder = TestData.Get(@"TestData\Preprocessor");
100
101 using (var fs = new DisposableFileSystem())
102 {
103 var baseFolder = fs.GetFolder(true);
104 var targetFile = Path.Combine(baseFolder, beforeFileName);
105 File.Copy(Path.Combine(folder, beforeFileName), Path.Combine(baseFolder, beforeFileName));
106
107 var settingsFile = Path.Combine(folder, "wixcop.settings.xml");
108
109 var result = RunConversion(targetFile, settingsFile: settingsFile);
110 Assert.Equal(9, result.ExitCode);
111
112 var expected = File.ReadAllText(Path.Combine(folder, afterFileName)).Replace("\r\n", "\n");
113 var actual = File.ReadAllText(targetFile).Replace("\r\n", "\n");
114 Assert.Equal(expected, actual);
115
116 EnsureFixed(targetFile);
117 }
118 }
119
120 [Fact]
121 public void CanConvertQtExec()
122 {
123 const string beforeFileName = "v3.wxs";
124 const string afterFileName = "v4_expected.wxs";
125 var folder = TestData.Get(@"TestData\QtExec");
126
127 using (var fs = new DisposableFileSystem())
128 {
129 var baseFolder = fs.GetFolder(true);
130 var targetFile = Path.Combine(baseFolder, beforeFileName);
131 File.Copy(Path.Combine(folder, beforeFileName), Path.Combine(baseFolder, beforeFileName));
132
133 var result = RunConversion(targetFile);
134 Assert.Equal(13, result.ExitCode);
135
136 var expected = File.ReadAllText(Path.Combine(folder, afterFileName)).Replace("\r\n", "\n");
137 var actual = File.ReadAllText(targetFile).Replace("\r\n", "\n");
138 Assert.Equal(expected, actual);
139
140 EnsureFixed(targetFile);
141 }
142 }
143
144 [Fact]
145 public void DetectUnconvertableQtExecCmdTimeout()
146 {
147 const string beforeFileName = "v3.wxs";
148 const string afterFileName = "v4_expected.wxs";
149 var folder = TestData.Get(@"TestData\QtExec.bad");
150
151 using (var fs = new DisposableFileSystem())
152 {
153 var baseFolder = fs.GetFolder(true);
154 var targetFile = Path.Combine(baseFolder, beforeFileName);
155 File.Copy(Path.Combine(folder, beforeFileName), Path.Combine(baseFolder, beforeFileName));
156
157 var result = RunConversion(targetFile);
158
159 Assert.Equal(13, result.ExitCode);
160 Assert.Single(result.Messages.Where(message => message.ToString().EndsWith("(QtExecCmdTimeoutAmbiguous)")));
161
162 var expected = File.ReadAllText(Path.Combine(folder, afterFileName)).Replace("\r\n", "\n");
163 var actual = File.ReadAllText(targetFile).Replace("\r\n", "\n");
164 Assert.Equal(expected, actual);
165
166 // still fails because QtExecCmdTimeoutAmbiguous is unfixable
167 var result2 = RunConversion(targetFile);
168 Assert.Equal(1, result2.ExitCode);
169 }
170 }
171
172 private static WixRunnerResult RunConversion(string targetFile, bool fixErrors = true, string settingsFile = null)
173 {
174 var serviceProvider = WixToolsetServiceProviderFactory.CreateServiceProvider().AddConverter();
175
176 var exitCode = WixRunner.Execute(new[]
177 {
178 "convert",
179 fixErrors ? null : "--dry-run",
180 String.IsNullOrEmpty(settingsFile) ? null : "-set1" + settingsFile,
181 targetFile
182 }, serviceProvider, out var messages);
183
184 return new WixRunnerResult { ExitCode = exitCode.Result, Messages = messages.ToArray() };
185 }
186
187 private static void EnsureFixed(string targetFile)
188 {
189 var messaging2 = new MockMessaging();
190 var converter2 = new WixConverter(messaging2, 4);
191 var errors2 = converter2.ConvertFile(targetFile, true);
192 Assert.Equal(0, errors2);
193 }
194 }
195}
diff --git a/src/test/WixToolsetTest.Converters/CustomActionFixture.cs b/src/test/WixToolsetTest.Converters/CustomActionFixture.cs
deleted file mode 100644
index eafc171a..00000000
--- a/src/test/WixToolsetTest.Converters/CustomActionFixture.cs
+++ /dev/null
@@ -1,88 +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
3namespace WixToolsetTest.Converters
4{
5 using System;
6 using System.IO;
7 using System.Xml.Linq;
8 using WixToolset.Converters;
9 using WixToolsetTest.Converters.Mocks;
10 using Xunit;
11
12 public class CustomActionFixture : BaseConverterFixture
13 {
14 [Fact]
15 public void CanConvertCustomAction()
16 {
17 var parse = String.Join(Environment.NewLine,
18 "<?xml version='1.0' encoding='utf-8'?>",
19 "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>",
20 " <CustomAction Id='Foo' BinaryKey='WixCA' DllEntry='CAQuietExec' />",
21 " <CustomAction Id='Foo' BinaryKey='WixCA_x64' DllEntry='CAQuietExec64' />",
22 " <CustomAction Id='Foo' BinaryKey='UtilCA' DllEntry='WixQuietExec' />",
23 " <CustomAction Id='Foo' BinaryKey='UtilCA_x64' DllEntry='WixQuietExec64' />",
24 "</Wix>");
25
26 var expected = String.Join(Environment.NewLine,
27 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
28 " <CustomAction Id=\"Foo\" DllEntry=\"WixQuietExec\" BinaryRef=\"Wix4UtilCA_X86\" />",
29 " <CustomAction Id=\"Foo\" DllEntry=\"WixQuietExec64\" BinaryRef=\"Wix4UtilCA_X64\" />",
30 " <CustomAction Id=\"Foo\" DllEntry=\"WixQuietExec\" BinaryRef=\"Wix4UtilCA_X86\" />",
31 " <CustomAction Id=\"Foo\" DllEntry=\"WixQuietExec64\" BinaryRef=\"Wix4UtilCA_X64\" />",
32 "</Wix>");
33
34 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
35
36 var messaging = new MockMessaging();
37 var converter = new WixConverter(messaging, 2, null, null);
38
39 var errors = converter.ConvertDocument(document);
40
41 var actual = UnformattedDocumentString(document);
42
43 Assert.Equal(11, errors);
44 Assert.Equal(expected, actual);
45 }
46
47 [Fact]
48 public void CanConvertCustomActionScript()
49 {
50 var parse = String.Join(Environment.NewLine,
51 "<?xml version='1.0' encoding='utf-8'?>",
52 "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>",
53 " <CustomAction Id='Foo' Script='jscript'>",
54 " function() {",
55 " var x = 0;",
56 " return x;",
57 " }",
58 " </CustomAction>",
59 "</Wix>");
60
61 var expected = String.Join(Environment.NewLine,
62 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
63 " <CustomAction Id=\"Foo\" Script=\"jscript\" ScriptSourceFile=\"Foo.js\" />",
64 "</Wix>");
65
66 var expectedScript = String.Join("\n",
67 "function() {",
68 " var x = 0;",
69 " return x;",
70 " }");
71
72 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
73
74 var messaging = new MockMessaging();
75 var converter = new WixConverter(messaging, 2, null, null);
76
77 var errors = converter.ConvertDocument(document);
78
79 var actual = UnformattedDocumentString(document);
80
81 Assert.Equal(2, errors);
82 Assert.Equal(expected, actual);
83
84 var script = File.ReadAllText("Foo.js");
85 Assert.Equal(expectedScript, script);
86 }
87 }
88}
diff --git a/src/test/WixToolsetTest.Converters/CustomTableFixture.cs b/src/test/WixToolsetTest.Converters/CustomTableFixture.cs
deleted file mode 100644
index 2b81a863..00000000
--- a/src/test/WixToolsetTest.Converters/CustomTableFixture.cs
+++ /dev/null
@@ -1,363 +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
3namespace 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 CustomTableFixture : BaseConverterFixture
13 {
14 [Fact]
15 public void FixCustomTableCategoryAndModularization()
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'>",
20 " <Fragment>",
21 " <CustomTable Id='Custom1'>",
22 " <Column Id='Column1' Type='string' Category='Text' Modularize='Column' />",
23 " </CustomTable>",
24 " </Fragment>",
25 "</Wix>");
26
27 var expected = new[]
28 {
29 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
30 " <Fragment>",
31 " <CustomTable Id=\"Custom1\">",
32 " <Column Id=\"Column1\" Type=\"string\" Category=\"text\" Modularize=\"column\" />",
33 " </CustomTable>",
34 " </Fragment>",
35 "</Wix>"
36 };
37
38 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
39
40 var messaging = new MockMessaging();
41 var converter = new WixConverter(messaging, 2, null, null);
42
43 var errors = converter.ConvertDocument(document);
44 Assert.Equal(4, errors);
45
46 var actualLines = UnformattedDocumentLines(document);
47 WixAssert.CompareLineByLine(expected, actualLines);
48 }
49
50 [Fact]
51 public void FixCustomRowTextValue()
52 {
53 var parse = String.Join(Environment.NewLine,
54 "<?xml version=\"1.0\" encoding=\"utf-16\"?>",
55 "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>",
56 " <Fragment>",
57 " <CustomTable Id='Custom1'>",
58 " <Row>",
59 " <Data Id='Column1'>",
60 " Some value",
61 " </Data>",
62 " </Row>",
63 " </CustomTable>",
64 " </Fragment>",
65 "</Wix>");
66
67 var expected = new[]
68 {
69 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
70 " <Fragment>",
71 " <CustomTable Id=\"Custom1\">",
72 " <Row>",
73 " <Data Id=\"Column1\" Value=\"Some value\" />",
74 " </Row>",
75 " </CustomTable>",
76 " </Fragment>",
77 "</Wix>"
78 };
79
80 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
81
82 var messaging = new MockMessaging();
83 var converter = new WixConverter(messaging, 2, null, null);
84
85 var errors = converter.ConvertDocument(document);
86 Assert.Equal(4, errors);
87
88 var actualLines = UnformattedDocumentLines(document);
89 WixAssert.CompareLineByLine(expected, actualLines);
90 }
91
92 [Fact]
93 public void FixCustomRowCdataValue()
94 {
95 var parse = String.Join(Environment.NewLine,
96 "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>",
97 " <Fragment>",
98 " <CustomTable Id='Custom1'>",
99 " <Row>",
100 " <Data Id='Column1'>",
101 " <![CDATA[",
102 " Some value",
103 " ]]>",
104 " </Data>",
105 " </Row>",
106 " </CustomTable>",
107 " </Fragment>",
108 "</Wix>");
109
110 var expected = new[]
111 {
112 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
113 " <Fragment>",
114 " <CustomTable Id=\"Custom1\">",
115 " <Row>",
116 " <Data Id=\"Column1\" Value=\"Some value\" />",
117 " </Row>",
118 " </CustomTable>",
119 " </Fragment>",
120 "</Wix>"
121 };
122
123 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
124
125 var messaging = new MockMessaging();
126 var converter = new WixConverter(messaging, 2, null, null);
127
128 var errors = converter.ConvertDocument(document);
129 Assert.Equal(3, errors);
130
131 var actualLines = UnformattedDocumentLines(document);
132 WixAssert.CompareLineByLine(expected, actualLines);
133 }
134
135 [Fact]
136 public void FixCustomRowWithoutValue()
137 {
138 var parse = String.Join(Environment.NewLine,
139 "<?xml version=\"1.0\" encoding=\"utf-16\"?>",
140 "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>",
141 " <Fragment>",
142 " <CustomTable Id='Custom1'>",
143 " <Row Id='Column1'></Row>",
144 " </CustomTable>",
145 " </Fragment>",
146 "</Wix>");
147
148 var expected = new[]
149 {
150 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
151 " <Fragment>",
152 " <CustomTable Id=\"Custom1\">",
153 " <Row Id=\"Column1\"></Row>",
154 " </CustomTable>",
155 " </Fragment>",
156 "</Wix>"
157 };
158
159 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
160
161 var messaging = new MockMessaging();
162 var converter = new WixConverter(messaging, 2, null, null);
163
164 var errors = converter.ConvertDocument(document);
165 Assert.Equal(3, errors);
166
167 var actualLines = UnformattedDocumentLines(document);
168 WixAssert.CompareLineByLine(expected, actualLines);
169 }
170
171 [Fact]
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()
313 {
314 var parse = String.Join(Environment.NewLine,
315 "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>",
316 " <CustomTable Id='FgAppx' BootstrapperApplicationData='yes' />",
317 "</Wix>");
318
319 var expected = String.Join(Environment.NewLine,
320 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
321 " <CustomTable Id=\"FgAppx\" BootstrapperApplicationData=\"yes\" />",
322 "</Wix>");
323
324 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
325
326 var messaging = new MockMessaging();
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);
354
355 var errors = converter.ConvertDocument(document);
356
357 var actual = UnformattedDocumentString(document);
358
359 Assert.Equal(1, errors);
360 Assert.Equal(expected, actual);
361 }
362 }
363}
diff --git a/src/test/WixToolsetTest.Converters/DependencyFixture.cs b/src/test/WixToolsetTest.Converters/DependencyFixture.cs
deleted file mode 100644
index 41ded927..00000000
--- a/src/test/WixToolsetTest.Converters/DependencyFixture.cs
+++ /dev/null
@@ -1,178 +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
3namespace 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}
diff --git a/src/test/WixToolsetTest.Converters/DirectoryFixture.cs b/src/test/WixToolsetTest.Converters/DirectoryFixture.cs
deleted file mode 100644
index 3c906320..00000000
--- a/src/test/WixToolsetTest.Converters/DirectoryFixture.cs
+++ /dev/null
@@ -1,92 +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
3namespace 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 DirectoryFixture : BaseConverterFixture
13 {
14 [Fact]
15 public void RemoveTargetDir()
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'>",
20 " <Fragment>",
21 " <Directory Id='TARGETDIR' Name='SourceDir'>",
22 " <!-- Comment -->",
23 " <Directory Id='RootFolder' Name='Root'>",
24 " <Directory Id='ChildFolder' Name='Child' />",
25 " </Directory>",
26 " </Directory>",
27 " </Fragment>",
28 "</Wix>");
29
30 var expected = new[]
31 {
32 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
33 " <Fragment>",
34 " <!-- Comment -->",
35 " <Directory Id=\"RootFolder\" Name=\"Root\">",
36 " <Directory Id=\"ChildFolder\" Name=\"Child\" />",
37 " </Directory>",
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(3, errors);
49
50 var actualLines = UnformattedDocumentLines(document);
51 WixAssert.CompareLineByLine(expected, actualLines);
52 }
53
54 [Fact]
55 public void FixStandardDirectory()
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'>",
60 " <Fragment>",
61 " <Directory Id='TARGETDIR' Name='SourceDir'>",
62 " <Directory Id='ProgramFilesFolder' Name='PFiles'>",
63 " <Directory Id='ChildFolder' Name='Child' />",
64 " </Directory>",
65 " </Directory>",
66 " </Fragment>",
67 "</Wix>");
68
69 var expected = new[]
70 {
71 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
72 " <Fragment>",
73 " <StandardDirectory Id=\"ProgramFilesFolder\">",
74 " <Directory Id=\"ChildFolder\" Name=\"Child\" />",
75 " </StandardDirectory>",
76 " </Fragment>",
77 "</Wix>"
78 };
79
80 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
81
82 var messaging = new MockMessaging();
83 var converter = new WixConverter(messaging, 2, null, null);
84
85 var errors = converter.ConvertDocument(document);
86 Assert.Equal(4, errors);
87
88 var actualLines = UnformattedDocumentLines(document);
89 WixAssert.CompareLineByLine(expected, actualLines);
90 }
91 }
92}
diff --git a/src/test/WixToolsetTest.Converters/ExePackageFixture.cs b/src/test/WixToolsetTest.Converters/ExePackageFixture.cs
deleted file mode 100644
index 0ee8d065..00000000
--- a/src/test/WixToolsetTest.Converters/ExePackageFixture.cs
+++ /dev/null
@@ -1,49 +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
3namespace 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 ExePackageFixture : BaseConverterFixture
13 {
14 [Fact]
15 public void CanConvertExePackageCommandToArguments()
16 {
17 var parse = String.Join(Environment.NewLine,
18 "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>",
19 " <Fragment>",
20 " <PackageGroup Id='exe'>",
21 " <ExePackage InstallCommand='-install' RepairCommand='-repair' UninstallCommand='-uninstall' SourceFile='test.exe' />",
22 " </PackageGroup>",
23 " </Fragment>",
24 "</Wix>");
25
26 var expected = new[]
27 {
28 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
29 " <Fragment>",
30 " <PackageGroup Id=\"exe\">",
31 " <ExePackage SourceFile=\"test.exe\" InstallArguments=\"-install\" RepairArguments=\"-repair\" UninstallArguments=\"-uninstall\" />",
32 " </PackageGroup>",
33 " </Fragment>",
34 "</Wix>"
35 };
36
37 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
38
39 var messaging = new MockMessaging();
40 var converter = new WixConverter(messaging, 2, null, null);
41
42 var errors = converter.ConvertDocument(document);
43 Assert.Equal(3, errors);
44
45 var actualLines = UnformattedDocumentLines(document);
46 WixAssert.CompareLineByLine(expected, actualLines);
47 }
48 }
49}
diff --git a/src/test/WixToolsetTest.Converters/FeatureFixture.cs b/src/test/WixToolsetTest.Converters/FeatureFixture.cs
deleted file mode 100644
index 1df94a81..00000000
--- a/src/test/WixToolsetTest.Converters/FeatureFixture.cs
+++ /dev/null
@@ -1,110 +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
3namespace 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 FeatureFixture : BaseConverterFixture
13 {
14 [Fact]
15 public void FixAllowAttributes()
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'>",
20 " <Fragment>",
21 " <Feature Absent='allow' AllowAdvertise='system' />",
22 " </Fragment>",
23 "</Wix>");
24
25 var expected = new[]
26 {
27 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
28 " <Fragment>",
29 " <Feature AllowAdvertise=\"yes\" />",
30 " </Fragment>",
31 "</Wix>"
32 };
33
34 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
35
36 var messaging = new MockMessaging();
37 var converter = new WixConverter(messaging, 2, null, null);
38
39 var errors = converter.ConvertDocument(document);
40 Assert.Equal(4, errors);
41
42 var actualLines = UnformattedDocumentLines(document);
43 WixAssert.CompareLineByLine(expected, actualLines);
44 }
45
46 [Fact]
47 public void FixDisallowAttributes()
48 {
49 var parse = String.Join(Environment.NewLine,
50 "<?xml version=\"1.0\" encoding=\"utf-16\"?>",
51 "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>",
52 " <Fragment>",
53 " <Feature Absent='disallow' AllowAdvertise='no' />",
54 " </Fragment>",
55 "</Wix>");
56
57 var expected = new[]
58 {
59 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
60 " <Fragment>",
61 " <Feature AllowAdvertise=\"no\" AllowAbsent=\"no\" />",
62 " </Fragment>",
63 "</Wix>"
64 };
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 Assert.Equal(3, errors);
73
74 var actualLines = UnformattedDocumentLines(document);
75 WixAssert.CompareLineByLine(expected, actualLines);
76 }
77
78 [Fact]
79 public void RemoveDeprecatedAllowAdvertiseAttributes()
80 {
81 var parse = String.Join(Environment.NewLine,
82 "<?xml version=\"1.0\" encoding=\"utf-16\"?>",
83 "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>",
84 " <Fragment>",
85 " <Feature AllowAdvertise='disallow' />",
86 " </Fragment>",
87 "</Wix>");
88
89 var expected = new[]
90 {
91 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
92 " <Fragment>",
93 " <Feature />",
94 " </Fragment>",
95 "</Wix>"
96 };
97
98 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
99
100 var messaging = new MockMessaging();
101 var converter = new WixConverter(messaging, 2, null, null);
102
103 var errors = converter.ConvertDocument(document);
104 Assert.Equal(3, errors);
105
106 var actualLines = UnformattedDocumentLines(document);
107 WixAssert.CompareLineByLine(expected, actualLines);
108 }
109 }
110}
diff --git a/src/test/WixToolsetTest.Converters/FirewallExtensionFixture.cs b/src/test/WixToolsetTest.Converters/FirewallExtensionFixture.cs
deleted file mode 100644
index a101019b..00000000
--- a/src/test/WixToolsetTest.Converters/FirewallExtensionFixture.cs
+++ /dev/null
@@ -1,47 +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
3namespace 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 FirewallExtensionFixture : 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}
diff --git a/src/test/WixToolsetTest.Converters/FormatFixture.cs b/src/test/WixToolsetTest.Converters/FormatFixture.cs
deleted file mode 100644
index 739fba66..00000000
--- a/src/test/WixToolsetTest.Converters/FormatFixture.cs
+++ /dev/null
@@ -1,117 +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
3namespace 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 FormatFixture : BaseConverterFixture
12 {
13 [Fact]
14 public void CanFixWhitespace()
15 {
16 var parse = String.Join(Environment.NewLine,
17 "<?xml version='1.0' encoding='utf-8'?>",
18 "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>",
19 " <Fragment>",
20 " <Property Id='Prop'",
21 " Value='Val'>",
22 " </Property>",
23 " </Fragment>",
24 "</Wix>");
25
26 var expected = String.Join(Environment.NewLine,
27 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
28 " <Fragment>",
29 " <Property Id=\"Prop\" Value=\"Val\" />",
30 " </Fragment>",
31 "</Wix>");
32
33 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
34
35 var messaging = new MockMessaging();
36 var converter = new WixConverter(messaging, 4, null, null);
37
38 var errors = converter.FormatDocument(document);
39
40 var actual = UnformattedDocumentString(document);
41
42 Assert.Equal(expected, actual);
43 Assert.Equal(5, errors);
44 }
45
46 [Fact]
47 public void CanPreserveNewLines()
48 {
49 var parse = String.Join(Environment.NewLine,
50 "<?xml version='1.0' encoding='utf-8'?>",
51 "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>",
52 " <Fragment>",
53 "",
54 " <Property Id='Prop' Value='Val' />",
55 "",
56 " </Fragment>",
57 "</Wix>");
58
59 var expected = String.Join(Environment.NewLine,
60 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
61 " <Fragment>",
62 "",
63 " <Property Id=\"Prop\" Value=\"Val\" />",
64 "",
65 " </Fragment>",
66 "</Wix>");
67
68 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
69
70 var messaging = new MockMessaging();
71 var converter = new WixConverter(messaging, 4, null, null);
72
73 var conversions = converter.FormatDocument(document);
74
75 var actual = UnformattedDocumentString(document);
76
77 Assert.Equal(expected, actual);
78 Assert.Equal(4, conversions);
79 }
80
81 [Fact]
82 public void CanFormatWithNewLineAtEndOfFile()
83 {
84 var parse = String.Join(Environment.NewLine,
85 "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>",
86 " <Fragment>",
87 "",
88 " <Property Id='Prop' Value='Val' />",
89 "",
90 " </Fragment>",
91 "</Wix>",
92 "");
93
94 var expected = String.Join(Environment.NewLine,
95 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
96 " <Fragment>",
97 "",
98 " <Property Id=\"Prop\" Value=\"Val\" />",
99 "",
100 " </Fragment>",
101 "</Wix>",
102 "");
103
104 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
105
106 var messaging = new MockMessaging();
107 var converter = new WixConverter(messaging, 4, null, null);
108
109 var conversions = converter.FormatDocument(document);
110
111 var actual = UnformattedDocumentString(document);
112
113 Assert.Equal(expected, actual);
114 Assert.Equal(3, conversions);
115 }
116 }
117}
diff --git a/src/test/WixToolsetTest.Converters/IncludeFixture.cs b/src/test/WixToolsetTest.Converters/IncludeFixture.cs
deleted file mode 100644
index 2fd8244f..00000000
--- a/src/test/WixToolsetTest.Converters/IncludeFixture.cs
+++ /dev/null
@@ -1,68 +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
3namespace 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 IncludeFixture : BaseConverterFixture
13 {
14 [Fact]
15 public void EnsureNamespace()
16 {
17 var parse = String.Join(Environment.NewLine,
18 "<Include>",
19 " <Fragment />",
20 "</Include>");
21
22 var expected = new[]
23 {
24 "<Include xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
25 " <Fragment />",
26 "</Include>"
27 };
28
29 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
30
31 var messaging = new MockMessaging();
32 var converter = new WixConverter(messaging, 2, null, null);
33
34 var errors = converter.ConvertDocument(document);
35 Assert.Equal(1, errors);
36
37 var actualLines = UnformattedDocumentLines(document);
38 WixAssert.CompareLineByLine(expected, actualLines);
39 }
40
41 [Fact]
42 public void FixNamespace()
43 {
44 var parse = String.Join(Environment.NewLine,
45 "<Include xmlns='http://schemas.microsoft.com/wix/2006/wi'>",
46 " <Fragment />",
47 "</Include>");
48
49 var expected = new[]
50 {
51 "<Include xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
52 " <Fragment />",
53 "</Include>"
54 };
55
56 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
57
58 var messaging = new MockMessaging();
59 var converter = new WixConverter(messaging, 2, null, null);
60
61 var errors = converter.ConvertDocument(document);
62 Assert.Equal(1, errors);
63
64 var actualLines = UnformattedDocumentLines(document);
65 WixAssert.CompareLineByLine(expected, actualLines);
66 }
67 }
68}
diff --git a/src/test/WixToolsetTest.Converters/Mocks/MockCoreServiceProvider.cs b/src/test/WixToolsetTest.Converters/Mocks/MockCoreServiceProvider.cs
deleted file mode 100644
index b6bb8a40..00000000
--- a/src/test/WixToolsetTest.Converters/Mocks/MockCoreServiceProvider.cs
+++ /dev/null
@@ -1,51 +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
3namespace WixToolsetTest.Converters.Mocks
4{
5 using System;
6 using System.Collections.Generic;
7 using WixToolset.Extensibility.Services;
8
9 public class MockCoreServiceProvider : IWixToolsetCoreServiceProvider
10 {
11 public Dictionary<Type, Func<IWixToolsetCoreServiceProvider, Dictionary<Type, object>, object>> CreationFunctions { get; } = new Dictionary<Type, Func<IWixToolsetCoreServiceProvider, Dictionary<Type, object>, object>>();
12
13 public Dictionary<Type, object> Singletons { get; } = new Dictionary<Type, object>()
14 {
15 { typeof(IMessaging), new MockMessaging() }
16 };
17
18 public void AddService(Type serviceType, Func<IWixToolsetCoreServiceProvider, Dictionary<Type, object>, object> creationFunction) => this.CreationFunctions.Add(serviceType, creationFunction);
19
20 public void AddService<T>(Func<IWixToolsetCoreServiceProvider, Dictionary<Type, object>, T> creationFunction) where T : class => this.AddService(typeof(T), creationFunction);
21
22 public T GetService<T>() where T : class => this.TryGetService(typeof(T), out var obj) ? (T)obj : null;
23
24 public object GetService(Type serviceType) => this.TryGetService(serviceType, out var service) ? service : null;
25
26 public bool TryGetService(Type serviceType, out object service)
27 {
28 if (!this.Singletons.TryGetValue(serviceType, out service))
29 {
30 if (this.CreationFunctions.TryGetValue(serviceType, out var creationFunction))
31 {
32 service = creationFunction(this, this.Singletons);
33 }
34 }
35
36 return service != null;
37 }
38
39 public bool TryGetService<T>(out T service) where T : class
40 {
41 service = null;
42
43 if (this.TryGetService(typeof(T), out var obj))
44 {
45 service = (T)obj;
46 }
47
48 return service != null;
49 }
50 }
51} \ No newline at end of file
diff --git a/src/test/WixToolsetTest.Converters/Mocks/MockMessaging.cs b/src/test/WixToolsetTest.Converters/Mocks/MockMessaging.cs
deleted file mode 100644
index 77821a1c..00000000
--- a/src/test/WixToolsetTest.Converters/Mocks/MockMessaging.cs
+++ /dev/null
@@ -1,39 +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
3namespace WixToolsetTest.Converters.Mocks
4{
5 using System;
6 using System.Collections.Generic;
7 using WixToolset.Data;
8 using WixToolset.Extensibility;
9 using WixToolset.Extensibility.Services;
10
11 public class MockMessaging : IMessaging
12 {
13 public List<Message> Messages { get; } = new List<Message>();
14
15 public bool EncounteredError { get; private set; }
16
17 public int LastErrorNumber { get; }
18
19 public bool ShowVerboseMessages { get; set; }
20
21 public bool SuppressAllWarnings { get; set; }
22
23 public bool WarningsAsError { get; set; }
24
25 public void ElevateWarningMessage(int warningNumber) => throw new NotImplementedException();
26
27 public void SetListener(IMessageListener listener) => throw new NotImplementedException();
28
29 public void SuppressWarningMessage(int warningNumber) => throw new NotImplementedException();
30
31 public void Write(Message message)
32 {
33 this.Messages.Add(message);
34 this.EncounteredError |= message.Level == MessageLevel.Error;
35 }
36
37 public void Write(string message, bool verbose = false) => throw new NotImplementedException();
38 }
39}
diff --git a/src/test/WixToolsetTest.Converters/ProductPackageFixture.cs b/src/test/WixToolsetTest.Converters/ProductPackageFixture.cs
deleted file mode 100644
index e01b9789..00000000
--- a/src/test/WixToolsetTest.Converters/ProductPackageFixture.cs
+++ /dev/null
@@ -1,278 +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
3namespace WixToolsetTest.Converters
4{
5 using System;
6 using System.IO;
7 using System.Xml.Linq;
8 using WixBuildTools.TestSupport;
9 using WixToolset.Converters;
10 using WixToolset.Core.TestPackage;
11 using WixToolsetTest.Converters.Mocks;
12 using Xunit;
13
14 public class ProductPackageFixture : BaseConverterFixture
15 {
16 [Fact]
17 public void FixesCompressedWhenYes()
18 {
19 var parse = String.Join(Environment.NewLine,
20 "<?xml version=\"1.0\" encoding=\"utf-16\"?>",
21 "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>",
22 " <Product>",
23 " <Package Compressed='yes' />",
24 " </Product>",
25 "</Wix>");
26
27 var expected = new[]
28 {
29 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
30 " <Package>",
31 " ",
32 " </Package>",
33 "</Wix>"
34 };
35
36 AssertSuccess(parse, 4, expected);
37 }
38
39 [Fact]
40 public void FixesCompressedWhenNo()
41 {
42 var parse = String.Join(Environment.NewLine,
43 "<?xml version=\"1.0\" encoding=\"utf-16\"?>",
44 "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>",
45 " <Product>",
46 " <Package Compressed='no' />",
47 " </Product>",
48 "</Wix>");
49
50 var expected = new[]
51 {
52 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
53 " <Package Compressed=\"no\">",
54 " ",
55 " </Package>",
56 "</Wix>"
57 };
58
59 AssertSuccess(parse, 4, expected);
60 }
61
62 [Fact]
63 public void FixesCompressedWhenOmitted()
64 {
65 var parse = String.Join(Environment.NewLine,
66 "<?xml version=\"1.0\" encoding=\"utf-16\"?>",
67 "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>",
68 " <Product>",
69 " <Package />",
70 " </Product>",
71 "</Wix>");
72
73 var expected = new[]
74 {
75 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
76 " <Package Compressed=\"no\">",
77 " ",
78 " </Package>",
79 "</Wix>"
80 };
81
82 AssertSuccess(parse, 4, expected);
83 }
84
85 private static void AssertSuccess(string input, int expectedErrorCount, string[] expected)
86 {
87 var document = XDocument.Parse(input, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
88
89 var messaging = new MockMessaging();
90 var converter = new WixConverter(messaging, 2, null, null);
91
92 var errors = converter.ConvertDocument(document);
93 Assert.Equal(expectedErrorCount, errors);
94
95 var actualLines = UnformattedDocumentLines(document);
96 WixAssert.CompareLineByLine(expected, actualLines);
97 }
98
99 [Fact]
100 public void FixesInstallerVersion()
101 {
102 var parse = String.Join(Environment.NewLine,
103 "<?xml version=\"1.0\" encoding=\"utf-16\"?>",
104 "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>",
105 " <Product>",
106 " <Package InstallerVersion='666' />",
107 " </Product>",
108 "</Wix>");
109
110 var expected = new[]
111 {
112 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
113 " <Package Compressed=\"no\" InstallerVersion=\"666\">",
114 " ",
115 " </Package>",
116 "</Wix>"
117 };
118
119 AssertSuccess(parse, 3, expected);
120 }
121
122 [Fact]
123 public void FixesDefaultInstallerVersion()
124 {
125 var parse = String.Join(Environment.NewLine,
126 "<?xml version=\"1.0\" encoding=\"utf-16\"?>",
127 "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>",
128 " <Product>",
129 " <Package InstallerVersion='500' />",
130 " </Product>",
131 "</Wix>");
132
133 var expected = new[]
134 {
135 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
136 " <Package Compressed=\"no\">",
137 " ",
138 " </Package>",
139 "</Wix>"
140 };
141
142 AssertSuccess(parse, 3, expected);
143 }
144
145 [Fact]
146 public void FixesImplicitInstallerVersion()
147 {
148 var parse = String.Join(Environment.NewLine,
149 "<?xml version=\"1.0\" encoding=\"utf-16\"?>",
150 "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>",
151 " <Product>",
152 " <Package />",
153 " </Product>",
154 "</Wix>");
155
156 var expected = new[]
157 {
158 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
159 " <Package Compressed=\"no\">",
160 " ",
161 " </Package>",
162 "</Wix>"
163 };
164
165 AssertSuccess(parse, 4, expected);
166 }
167
168 [Fact]
169 public void FixesNonDefaultInstallerVersion()
170 {
171 var parse = String.Join(Environment.NewLine,
172 "<?xml version=\"1.0\" encoding=\"utf-16\"?>",
173 "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>",
174 " <Product>",
175 " <Package InstallerVersion='200' />",
176 " </Product>",
177 "</Wix>");
178
179 var expected = new[]
180 {
181 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
182 " <Package Compressed=\"no\" InstallerVersion=\"200\">",
183 " ",
184 " </Package>",
185 "</Wix>"
186 };
187
188 AssertSuccess(parse, 3, expected);
189 }
190
191 [Fact]
192 public void FixesLimitedInstallerPrivileges()
193 {
194 var parse = String.Join(Environment.NewLine,
195 "<?xml version=\"1.0\" encoding=\"utf-16\"?>",
196 "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>",
197 " <Product>",
198 " <Package InstallPrivileges='limited' />",
199 " </Product>",
200 "</Wix>");
201
202 var expected = new[]
203 {
204 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
205 " <Package Compressed=\"no\" Scope=\"perUser\">",
206 " ",
207 " </Package>",
208 "</Wix>"
209 };
210
211 AssertSuccess(parse, 4, expected);
212 }
213
214 [Fact]
215 public void FixesElevatedInstallerPrivileges()
216 {
217 var parse = String.Join(Environment.NewLine,
218 "<?xml version=\"1.0\" encoding=\"utf-16\"?>",
219 "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>",
220 " <Product>",
221 " <Package InstallPrivileges='elevated' />",
222 " <Property Id='ALLUSERS' Value='1' />",
223 " </Product>",
224 "</Wix>");
225
226 var expected = new[]
227 {
228 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
229 " <Package Compressed=\"no\">",
230 " ",
231 " ",
232 " </Package>",
233 "</Wix>"
234 };
235
236 AssertSuccess(parse, 4, expected);
237 }
238
239 [Fact]
240 public void CanDecompileAndRecompile()
241 {
242 using (var fs = new DisposableFileSystem())
243 {
244 var baseFolder = fs.GetFolder();
245 var intermediateFolder = Path.Combine(baseFolder, "obj");
246 var decompiledWxsPath = Path.Combine(baseFolder, "TypicalV3.wxs");
247
248 var folder = TestData.Get(@"TestData\PackageSummaryInformation");
249 var v3msiPath = Path.Combine(folder, "TypicalV3.msi");
250 var result = WixRunner.Execute(new[]
251 {
252 "decompile", v3msiPath,
253 "-intermediateFolder", intermediateFolder,
254 "-o", decompiledWxsPath
255 });
256
257 result.AssertSuccess();
258
259 var v4msiPath = Path.Combine(intermediateFolder, "TypicalV4.msi");
260 result = WixRunner.Execute(new[]
261 {
262 "build", decompiledWxsPath,
263 "-arch", "x64",
264 "-intermediateFolder", intermediateFolder,
265 "-o", v4msiPath
266 });
267
268 result.AssertSuccess();
269
270 Assert.True(File.Exists(v4msiPath));
271
272 var v3results = Query.QueryDatabase(v3msiPath, new[] { "_SummaryInformation", "Property" });
273 var v4results = Query.QueryDatabase(v4msiPath, new[] { "_SummaryInformation", "Property" });
274 WixAssert.CompareLineByLine(v3results, v4results);
275 }
276 }
277 }
278}
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
3namespace 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&lt;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&lt;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}
diff --git a/src/test/WixToolsetTest.Converters/RegistryFixture.cs b/src/test/WixToolsetTest.Converters/RegistryFixture.cs
deleted file mode 100644
index 405f5416..00000000
--- a/src/test/WixToolsetTest.Converters/RegistryFixture.cs
+++ /dev/null
@@ -1,54 +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
3namespace 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 RegistryFixture : BaseConverterFixture
13 {
14 [Fact]
15 public void FixRegistryKeyAction()
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'>",
20 " <Fragment>",
21 " <Component>",
22 " <RegistryKey Id='ExampleRegistryKey1' Action='create' Root='HKLM' Key='TestRegistryKey1' />",
23 " <RegistryKey Id='ExampleRegistryKey2' Action='createAndRemoveOnUninstall' Root='HKLM' Key='TestRegistryKey2' />",
24 " <RegistryKey Id='ExampleRegistryKey3' Action='none' Root='HKLM' Key='TestRegistryKey3' />",
25 " </Component>",
26 " </Fragment>",
27 "</Wix>");
28
29 var expected = new[]
30 {
31 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
32 " <Fragment>",
33 " <Component>",
34 " <RegistryKey Id=\"ExampleRegistryKey1\" Root=\"HKLM\" Key=\"TestRegistryKey1\" ForceCreateOnInstall=\"yes\" />",
35 " <RegistryKey Id=\"ExampleRegistryKey2\" Root=\"HKLM\" Key=\"TestRegistryKey2\" ForceCreateOnInstall=\"yes\" ForceDeleteOnUninstall=\"yes\" />",
36 " <RegistryKey Id=\"ExampleRegistryKey3\" Root=\"HKLM\" Key=\"TestRegistryKey3\" />",
37 " </Component>",
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}
diff --git a/src/test/WixToolsetTest.Converters/RemotePayloadFixture.cs b/src/test/WixToolsetTest.Converters/RemotePayloadFixture.cs
deleted file mode 100644
index b2640e13..00000000
--- a/src/test/WixToolsetTest.Converters/RemotePayloadFixture.cs
+++ /dev/null
@@ -1,104 +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
3namespace 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 RemotePayloadFixture : BaseConverterFixture
13 {
14 [Fact]
15 public void CanConvertExePackageRemotePayload()
16 {
17 var parse = String.Join(Environment.NewLine,
18 "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>",
19 " <Fragment>",
20 " <PackageGroup Id='exe'>",
21 " <ExePackage Name='example.exe' DownloadUrl='example.com'>",
22 " <RemotePayload",
23 " Description='Microsoft ASP.NET Core 3.1.8 - Shared Framework'",
24 " Hash='61DC9EAA0C8968E48E13C5913ED202A2F8F94DBA'",
25 " CertificatePublicKey='3756E9BBF4461DCD0AA68E0D1FCFFA9CEA47AC18'",
26 " CertificateThumbprint='2485A7AFA98E178CB8F30C9838346B514AEA4769'",
27 " ProductName='Microsoft ASP.NET Core 3.1.8 - Shared Framework'",
28 " Size='7841880'",
29 " Version='3.1.8.20421' />",
30 " </ExePackage>",
31 " </PackageGroup>",
32 " </Fragment>",
33 "</Wix>");
34
35 var expected = new[]
36 {
37 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
38 " <Fragment>",
39 " <PackageGroup Id=\"exe\">",
40 " <ExePackage>",
41 " <ExePackagePayload Description=\"Microsoft ASP.NET Core 3.1.8 - Shared Framework\" Hash=\"61DC9EAA0C8968E48E13C5913ED202A2F8F94DBA\" ProductName=\"Microsoft ASP.NET Core 3.1.8 - Shared Framework\" Size=\"7841880\" Version=\"3.1.8.20421\" Name=\"example.exe\" DownloadUrl=\"example.com\" />",
42 " </ExePackage>",
43 " </PackageGroup>",
44 " </Fragment>",
45 "</Wix>"
46 };
47
48 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
49
50 var messaging = new MockMessaging();
51 var converter = new WixConverter(messaging, 2, null, null);
52
53 var errors = converter.ConvertDocument(document);
54 Assert.Equal(6, errors);
55
56 var actualLines = UnformattedDocumentLines(document);
57 WixAssert.CompareLineByLine(expected, actualLines);
58 }
59
60 [Fact]
61 public void CanConvertMsuPackageRemotePayload()
62 {
63 var parse = String.Join(Environment.NewLine,
64 "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>",
65 " <Fragment>",
66 " <PackageGroup Id='msu'>",
67 " <MsuPackage Name='example.msu' DownloadUrl='example.com' Compressed='no'>",
68 " <RemotePayload",
69 " Description='msu description'",
70 " Hash='71DC9EAA0C8968E48E13C5913ED202A2F8F94DBB'",
71 " ProductName='msu product name'",
72 " Size='500'",
73 " Version='0.0.0.0' />",
74 " </MsuPackage>",
75 " </PackageGroup>",
76 " </Fragment>",
77 "</Wix>");
78
79 var expected = new[]
80 {
81 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
82 " <Fragment>",
83 " <PackageGroup Id=\"msu\">",
84 " <MsuPackage>",
85 " <MsuPackagePayload Description=\"msu description\" Hash=\"71DC9EAA0C8968E48E13C5913ED202A2F8F94DBB\" ProductName=\"msu product name\" Size=\"500\" Version=\"0.0.0.0\" Name=\"example.msu\" DownloadUrl=\"example.com\" />",
86 " </MsuPackage>",
87 " </PackageGroup>",
88 " </Fragment>",
89 "</Wix>"
90 };
91
92 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
93
94 var messaging = new MockMessaging();
95 var converter = new WixConverter(messaging, 2, null, null);
96
97 var errors = converter.ConvertDocument(document);
98 Assert.Equal(5, errors);
99
100 var actualLines = UnformattedDocumentLines(document);
101 WixAssert.CompareLineByLine(expected, actualLines);
102 }
103 }
104}
diff --git a/src/test/WixToolsetTest.Converters/SequenceFixture.cs b/src/test/WixToolsetTest.Converters/SequenceFixture.cs
deleted file mode 100644
index ec6c709b..00000000
--- a/src/test/WixToolsetTest.Converters/SequenceFixture.cs
+++ /dev/null
@@ -1,49 +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
3namespace 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 SequenceFixture : BaseConverterFixture
13 {
14 [Fact]
15 public void FixCondition()
16 {
17 var parse = String.Join(Environment.NewLine,
18 "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>",
19 " <Fragment>",
20 " <InstallUISequence>",
21 " <Custom Action='ExampleCA' After='InstallFiles'>NOT Installed</Custom>",
22 " </InstallUISequence>",
23 " </Fragment>",
24 "</Wix>");
25
26 var expected = new[]
27 {
28 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
29 " <Fragment>",
30 " <InstallUISequence>",
31 " <Custom Action=\"ExampleCA\" After=\"InstallFiles\" Condition=\"NOT Installed\" />",
32 " </InstallUISequence>",
33 " </Fragment>",
34 "</Wix>"
35 };
36
37 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
38
39 var messaging = new MockMessaging();
40 var converter = new WixConverter(messaging, 2, null, null);
41
42 var errors = converter.ConvertDocument(document);
43 Assert.Equal(2, errors);
44
45 var actualLines = UnformattedDocumentLines(document);
46 WixAssert.CompareLineByLine(expected, actualLines);
47 }
48 }
49}
diff --git a/src/test/WixToolsetTest.Converters/TagFixture.cs b/src/test/WixToolsetTest.Converters/TagFixture.cs
deleted file mode 100644
index 5e07c83b..00000000
--- a/src/test/WixToolsetTest.Converters/TagFixture.cs
+++ /dev/null
@@ -1,111 +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
3namespace 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 TagFixture : BaseConverterFixture
13 {
14 [Fact]
15 public void FixTagExtension()
16 {
17 var parse = String.Join(Environment.NewLine,
18 "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:tag='http://schemas.microsoft.com/wix/TagExtension'>",
19 " <Product>",
20 " <tag:Tag Regid='wixtoolset.org' InstallDirectory='InstallFolder' />",
21 " </Product>",
22 "</Wix>");
23
24 var expected = new[]
25 {
26 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
27 " <Package>",
28 " <SoftwareTag Regid=\"wixtoolset.org\" InstallDirectory=\"InstallFolder\" />",
29 " </Package>",
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 WixAssert.CompareLineByLine(expected, actualLines);
43 }
44
45 [Fact]
46 public void FixTagExtensionDeprecations()
47 {
48 var parse = String.Join(Environment.NewLine,
49 "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:tag='http://schemas.microsoft.com/wix/TagExtension'>",
50 " <Product>",
51 " <tag:Tag Regid='wixtoolset.org' InstallDirectory='InstallFolder' Licensed='true' Type='component' Win64='yes' />",
52 " </Product>",
53 "</Wix>");
54
55 var expected = new[]
56 {
57 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
58 " <Package>",
59 " <SoftwareTag Regid=\"wixtoolset.org\" InstallDirectory=\"InstallFolder\" Bitness=\"always64\" />",
60 " </Package>",
61 "</Wix>"
62 };
63
64 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
65
66 var messaging = new MockMessaging();
67 var converter = new WixConverter(messaging, 2, null, null);
68
69 var errors = converter.ConvertDocument(document);
70 Assert.Equal(7, errors);
71
72 var actualLines = UnformattedDocumentLines(document);
73 WixAssert.CompareLineByLine(expected, actualLines);
74 }
75
76 [Fact]
77 public void FixTagExtensionTagRef()
78 {
79 var parse = String.Join(Environment.NewLine,
80 "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:tag='http://schemas.microsoft.com/wix/TagExtension'>",
81 " <Fragment>",
82 " <PatchFamily>",
83 " <tag:TagRef Regid='wixtoolset.org' />",
84 " </PatchFamily>",
85 " </Fragment>",
86 "</Wix>");
87
88 var expected = new[]
89 {
90 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
91 " <Fragment>",
92 " <PatchFamily>",
93 " <SoftwareTagRef Regid=\"wixtoolset.org\" />",
94 " </PatchFamily>",
95 " </Fragment>",
96 "</Wix>"
97 };
98
99 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
100
101 var messaging = new MockMessaging();
102 var converter = new WixConverter(messaging, 2, null, null);
103
104 var errors = converter.ConvertDocument(document);
105 Assert.Equal(3, errors);
106
107 var actualLines = UnformattedDocumentLines(document);
108 WixAssert.CompareLineByLine(expected, actualLines);
109 }
110 }
111}
diff --git a/src/test/WixToolsetTest.Converters/TestData/PackageSummaryInformation/TypicalV3.msi b/src/test/WixToolsetTest.Converters/TestData/PackageSummaryInformation/TypicalV3.msi
deleted file mode 100644
index 0d7e1b21..00000000
--- a/src/test/WixToolsetTest.Converters/TestData/PackageSummaryInformation/TypicalV3.msi
+++ /dev/null
Binary files differ
diff --git a/src/test/WixToolsetTest.Converters/TestData/PackageSummaryInformation/TypicalV3.wxs b/src/test/WixToolsetTest.Converters/TestData/PackageSummaryInformation/TypicalV3.wxs
deleted file mode 100644
index 8c5027b4..00000000
--- a/src/test/WixToolsetTest.Converters/TestData/PackageSummaryInformation/TypicalV3.wxs
+++ /dev/null
@@ -1,37 +0,0 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
3 <?define Name = "Package and summary information testing" ?>
4
5 <Product Id="*"
6 Name="$(var.Name)"
7 Language="1033"
8 Version="1.0"
9 Manufacturer="Example Corporation"
10 UpgradeCode="D86CAC27-51EA-46BD-8105-C465109AFA74">
11
12 <Package InstallerVersion="500"
13 Compressed="yes"
14 InstallScope="perMachine"
15 Platform="x64"
16 InstallPrivileges="elevated" />
17
18 <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
19 <MediaTemplate EmbedCab="yes" />
20
21 <Feature Id="Feature" Title="Installer" Level="1">
22 <ComponentGroupRef Id="ProductComponents" />
23 </Feature>
24
25 <Directory Id="TARGETDIR" Name="SourceDir">
26 <Directory Id="ProgramFiles64Folder">
27 <Directory Id="INSTALLFOLDER" Name="$(var.Name)" />
28 </Directory>
29 </Directory>
30
31 <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
32 <Component>
33 <RegistryValue Root="HKLM" Key="SOFTWARE\Example\$(var.Name)" Name="Installed" Value="1" Type="integer" />
34 </Component>
35 </ComponentGroup>
36 </Product>
37</Wix> \ No newline at end of file
diff --git a/src/test/WixToolsetTest.Converters/TestData/PermissionEx/v3.wxs b/src/test/WixToolsetTest.Converters/TestData/PermissionEx/v3.wxs
deleted file mode 100644
index 9a739052..00000000
--- a/src/test/WixToolsetTest.Converters/TestData/PermissionEx/v3.wxs
+++ /dev/null
@@ -1,26 +0,0 @@
1<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
2 <Fragment>
3 <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
4 <Component>
5 <File Source="example.txt">
6 <util:PermissionEx User="Everyone" GenericAll="yes" />
7 </File>
8 <CreateFolder>
9 <util:PermissionEx User="Everyone" GenericAll="yes" />
10 </CreateFolder>
11 <ServiceInstall Name="testsvc" Type="ownProcess" Start="disabled" ErrorControl="normal">
12 <util:PermissionEx User="Everyone" GenericAll="yes" />
13 </ServiceInstall>
14 <Registry Action="createKey" Root="HKLM" Key="TestKey">
15 <util:PermissionEx User="Everyone" GenericAll="yes" />
16 </Registry>
17 <RegistryKey Id="ExampleRegistryKey" ForceCreateOnInstall="yes" Root="HKLM" Key="TestRegistryKey">
18 <util:PermissionEx User="Everyone" GenericAll="yes" />
19 </RegistryKey>
20 <RegistryValue Root="HKLM" Key="TestRegistryValueKey" Value="abc">
21 <util:PermissionEx User="Everyone" GenericAll="yes" />
22 </RegistryValue>
23 </Component>
24 </ComponentGroup>
25 </Fragment>
26</Wix>
diff --git a/src/test/WixToolsetTest.Converters/TestData/PermissionEx/v4_expected.wxs b/src/test/WixToolsetTest.Converters/TestData/PermissionEx/v4_expected.wxs
deleted file mode 100644
index 6bf3c1ea..00000000
--- a/src/test/WixToolsetTest.Converters/TestData/PermissionEx/v4_expected.wxs
+++ /dev/null
@@ -1,26 +0,0 @@
1<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util">
2 <Fragment>
3 <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
4 <Component>
5 <File Id="example.txt" Source="example.txt">
6 <util:PermissionEx User="Everyone" GenericAll="yes" Inheritable="no" />
7 </File>
8 <CreateFolder>
9 <util:PermissionEx User="Everyone" GenericAll="yes" />
10 </CreateFolder>
11 <ServiceInstall Name="testsvc" Type="ownProcess" Start="disabled" ErrorControl="normal">
12 <util:PermissionEx User="Everyone" GenericAll="yes" Inheritable="no" />
13 </ServiceInstall>
14 <Registry Action="createKey" Root="HKLM" Key="TestKey">
15 <util:PermissionEx User="Everyone" GenericAll="yes" Inheritable="no" />
16 </Registry>
17 <RegistryKey Id="ExampleRegistryKey" ForceCreateOnInstall="yes" Root="HKLM" Key="TestRegistryKey">
18 <util:PermissionEx User="Everyone" GenericAll="yes" Inheritable="no" />
19 </RegistryKey>
20 <RegistryValue Root="HKLM" Key="TestRegistryValueKey" Value="abc">
21 <util:PermissionEx User="Everyone" GenericAll="yes" Inheritable="no" />
22 </RegistryValue>
23 </Component>
24 </ComponentGroup>
25 </Fragment>
26</Wix>
diff --git a/src/test/WixToolsetTest.Converters/TestData/Preprocessor/ConvertedPreprocessor.wxs b/src/test/WixToolsetTest.Converters/TestData/Preprocessor/ConvertedPreprocessor.wxs
deleted file mode 100644
index 8188d900..00000000
--- a/src/test/WixToolsetTest.Converters/TestData/Preprocessor/ConvertedPreprocessor.wxs
+++ /dev/null
@@ -1,61 +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
4
5<?include WixVer.wxi ?>
6
7<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util">
8 <Package Name="!(loc.ShortProduct) v$(var.WixMajorMinor) Core" Language="1033" Manufacturer="!(loc.Company)" Version="$(var.WixMsiProductVersion)" UpgradeCode="3618724B-2523-44F9-A908-866AA619504D" InstallerVersion="200">
9
10 <SoftwareTag Regid="!(loc.Regid)" InstallDirectory="INSTALLFOLDER" />
11
12 <MajorUpgrade DowngradeErrorMessage="A later version of [ProductName] is already installed." />
13
14 <MediaTemplate CabinetTemplate="core{0}.cab" />
15
16 <Feature Id="Feature_WiX" Title="WiX Toolset" Level="1">
17 <Component Id="Licensing" Directory="INSTALLFOLDER">
18 <File Id="LICENSE.TXT" Source="LICENSE.TXT" />
19 </Component>
20
21 <Component Id="ProductRegistration" Directory="INSTALLFOLDER">
22 <RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Windows Installer XML\$(var.WixMajorMinor)">
23 <RegistryValue Name="InstallFolder" Value="[INSTALLFOLDER]" Type="string" />
24 </RegistryKey>
25 </Component>
26
27 <Component Id="ProductFamilyRegistration" Directory="INSTALLFOLDER">
28 <RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Windows Installer XML\$(var.WixMajor).x">
29 <RegistryValue Name="v$(var.WixMajorMinor)" Value="[INSTALLFOLDER]" Type="string" />
30 </RegistryKey>
31 </Component>
32
33 <Component Id="ProductInformation" Directory="BinFolder">
34 <RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Windows Installer XML\$(var.WixMajorMinor)">
35 <RegistryValue Name="InstallRoot" Value="[BinFolder]" Type="string" />
36 <RegistryValue Name="ProductVersion" Value="[ProductVersion]" Type="string" />
37 </RegistryKey>
38
39 <RemoveFolder Id="CleanupShortcutFolder" Directory="ShortcutFolder" On="uninstall" />
40 </Component>
41
42 <Component Directory="BinFolder">
43 <File Id="wixtoolset.org.ico" Source="common\wixtoolset.org.ico">
44 <?include ComRegistration.wxi ?>
45 </File>
46 <util:InternetShortcut Id="wixtoolset.org" Directory="ShortcutFolder" Name="WiX Home Page" Target="http://wixtoolset.org/" IconFile="file://[#wixtoolset.org.ico]" />
47 </Component>
48
49 <ComponentGroupRef Id="ToolsetComponents" />
50 <ComponentGroupRef Id="ExtensionComponents" />
51 <ComponentGroupRef Id="LuxComponents" />
52 <ComponentGroupRef Id="DocComponents" />
53 </Feature>
54
55 <FeatureRef Id="Feature_MSBuild" />
56 <FeatureRef Id="Feature_Intellisense2010" />
57 <FeatureRef Id="Feature_Intellisense2012" />
58 <FeatureRef Id="Feature_Intellisense2013" />
59 <FeatureRef Id="Feature_Intellisense2015" />
60 </Package>
61</Wix>
diff --git a/src/test/WixToolsetTest.Converters/TestData/Preprocessor/Preprocessor.wxs b/src/test/WixToolsetTest.Converters/TestData/Preprocessor/Preprocessor.wxs
deleted file mode 100644
index 2eb908c2..00000000
--- a/src/test/WixToolsetTest.Converters/TestData/Preprocessor/Preprocessor.wxs
+++ /dev/null
@@ -1,63 +0,0 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<!-- 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. -->
3
4
5
6<?include WixVer.wxi ?>
7
8<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:swid="http://schemas.microsoft.com/wix/TagExtension" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
9 <Product Id="*" Name="!(loc.ShortProduct) v$(var.WixMajorMinor) Core" Language="1033" Manufacturer="!(loc.Company)"
10 Version="$(var.WixMsiProductVersion)" UpgradeCode="3618724B-2523-44F9-A908-866AA619504D">
11 <Package Compressed="yes" InstallerVersion="200" SummaryCodepage="1252" InstallScope="perMachine" />
12 <swid:Tag Regid="!(loc.Regid)" InstallDirectory="INSTALLFOLDER" />
13
14 <MajorUpgrade DowngradeErrorMessage="A later version of [ProductName] is already installed." />
15
16 <MediaTemplate CabinetTemplate="core{0}.cab" />
17
18 <Feature Id="Feature_WiX" Title="WiX Toolset" Level="1">
19 <Component Id="Licensing" Directory="INSTALLFOLDER">
20 <File Source="LICENSE.TXT" />
21 </Component>
22
23 <Component Id="ProductRegistration" Directory="INSTALLFOLDER">
24 <RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Windows Installer XML\$(var.WixMajorMinor)">
25 <RegistryValue Name="InstallFolder" Value="[INSTALLFOLDER]" Type="string" />
26 </RegistryKey>
27 </Component>
28
29 <Component Id="ProductFamilyRegistration" Directory="INSTALLFOLDER">
30 <RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Windows Installer XML\$(var.WixMajor).x">
31 <RegistryValue Name="v$(var.WixMajorMinor)" Value="[INSTALLFOLDER]" Type="string" />
32 </RegistryKey>
33 </Component>
34
35 <Component Id="ProductInformation" Directory="BinFolder">
36 <RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Windows Installer XML\$(var.WixMajorMinor)">
37 <RegistryValue Name="InstallRoot" Value="[BinFolder]" Type="string"/>
38 <RegistryValue Name="ProductVersion" Value="[ProductVersion]" Type="string" />
39 </RegistryKey>
40
41 <RemoveFolder Id="CleanupShortcutFolder" Directory="ShortcutFolder" On="uninstall" />
42 </Component>
43
44 <Component Directory="BinFolder">
45 <File Source="common\wixtoolset.org.ico">
46 <?include ComRegistration.wxi ?>
47 </File>
48 <util:InternetShortcut Id="wixtoolset.org" Directory="ShortcutFolder" Name="WiX Home Page" Target="http://wixtoolset.org/" IconFile="file://[#wixtoolset.org.ico]" />
49 </Component>
50
51 <ComponentGroupRef Id="ToolsetComponents" />
52 <ComponentGroupRef Id="ExtensionComponents" />
53 <ComponentGroupRef Id="LuxComponents" />
54 <ComponentGroupRef Id="DocComponents" />
55 </Feature>
56
57 <FeatureRef Id="Feature_MSBuild" />
58 <FeatureRef Id="Feature_Intellisense2010" />
59 <FeatureRef Id="Feature_Intellisense2012" />
60 <FeatureRef Id="Feature_Intellisense2013" />
61 <FeatureRef Id="Feature_Intellisense2015" />
62 </Product>
63</Wix>
diff --git a/src/test/WixToolsetTest.Converters/TestData/Preprocessor/wixcop.settings.xml b/src/test/WixToolsetTest.Converters/TestData/Preprocessor/wixcop.settings.xml
deleted file mode 100644
index 9d3ad496..00000000
--- a/src/test/WixToolsetTest.Converters/TestData/Preprocessor/wixcop.settings.xml
+++ /dev/null
@@ -1,9 +0,0 @@
1<?xml version="1.0"?>
2<Settings>
3 <IgnoreErrors>
4 <Test Id="WhitespacePrecedingNodeWrong"/>
5 <Test Id="WhitespacePrecedingEndElementWrong"/>
6 </IgnoreErrors>
7 <ErrorsAsWarnings/>
8 <ExemptFiles/>
9</Settings> \ No newline at end of file
diff --git a/src/test/WixToolsetTest.Converters/TestData/QtExec.bad/v3.wxs b/src/test/WixToolsetTest.Converters/TestData/QtExec.bad/v3.wxs
deleted file mode 100644
index b0fcf9c9..00000000
--- a/src/test/WixToolsetTest.Converters/TestData/QtExec.bad/v3.wxs
+++ /dev/null
@@ -1,64 +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
4
5<?include WixVer.wxi ?>
6
7<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:swid="http://schemas.microsoft.com/wix/TagExtension" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
8 <Product Id="*" Name="!(loc.ShortProduct) v$(var.WixMajorMinor) Core" Language="1033" Manufacturer="!(loc.Company)"
9 Version="$(var.WixMsiProductVersion)" UpgradeCode="3618724B-2523-44F9-A908-866AA619504D">
10 <Package Compressed="yes" InstallerVersion="200" SummaryCodepage="1252" InstallScope="perMachine" />
11 <swid:Tag Regid="!(loc.Regid)" InstallDirectory="INSTALLFOLDER" />
12
13 <MajorUpgrade DowngradeErrorMessage="A later version of [ProductName] is already installed." />
14
15 <MediaTemplate CabinetTemplate="core{0}.cab" />
16
17 <Property Id="QtExecCmdTimeout" Value="600000" />
18 <CustomAction Id="InstallVSTemplateCommand" Property="QtExecCmdLine" Value="&quot;[VSENVPRODUCT80]\devenv.exe&quot; /setup" />
19 <CustomAction Id="InstallVSTemplate" BinaryKey="WixCA" DllEntry="CAQuietExec" Return="asyncWait" />
20
21 <Feature Id="Feature_WiX" Title="WiX Toolset" Level="1">
22 <Component Id="Licensing" Directory="INSTALLFOLDER">
23 <File Source="LICENSE.TXT" />
24 </Component>
25
26 <Component Id="ProductRegistration" Directory="INSTALLFOLDER">
27 <RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Windows Installer XML\$(var.WixMajorMinor)">
28 <RegistryValue Name="InstallFolder" Value="[INSTALLFOLDER]" Type="string" />
29 </RegistryKey>
30 </Component>
31
32 <Component Id="ProductFamilyRegistration" Directory="INSTALLFOLDER">
33 <RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Windows Installer XML\$(var.WixMajor).x">
34 <RegistryValue Name="v$(var.WixMajorMinor)" Value="[INSTALLFOLDER]" Type="string" />
35 </RegistryKey>
36 </Component>
37
38 <Component Id="ProductInformation" Directory="BinFolder">
39 <RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Windows Installer XML\$(var.WixMajorMinor)">
40 <RegistryValue Name="InstallRoot" Value="[BinFolder]" Type="string"/>
41 <RegistryValue Name="ProductVersion" Value="[ProductVersion]" Type="string" />
42 </RegistryKey>
43
44 <RemoveFolder Id="CleanupShortcutFolder" Directory="ShortcutFolder" On="uninstall" />
45 </Component>
46
47 <Component Directory="BinFolder">
48 <File Source="common\wixtoolset.org.ico" />
49 <util:InternetShortcut Id="wixtoolset.org" Directory="ShortcutFolder" Name="WiX Home Page" Target="http://wixtoolset.org/" IconFile="file://[#wixtoolset.org.ico]" />
50 </Component>
51
52 <ComponentGroupRef Id="ToolsetComponents" />
53 <ComponentGroupRef Id="ExtensionComponents" />
54 <ComponentGroupRef Id="LuxComponents" />
55 <ComponentGroupRef Id="DocComponents" />
56 </Feature>
57
58 <FeatureRef Id="Feature_MSBuild" />
59 <FeatureRef Id="Feature_Intellisense2010" />
60 <FeatureRef Id="Feature_Intellisense2012" />
61 <FeatureRef Id="Feature_Intellisense2013" />
62 <FeatureRef Id="Feature_Intellisense2015" />
63 </Product>
64</Wix>
diff --git a/src/test/WixToolsetTest.Converters/TestData/QtExec.bad/v4_expected.wxs b/src/test/WixToolsetTest.Converters/TestData/QtExec.bad/v4_expected.wxs
deleted file mode 100644
index 95d2f618..00000000
--- a/src/test/WixToolsetTest.Converters/TestData/QtExec.bad/v4_expected.wxs
+++ /dev/null
@@ -1,63 +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
4
5<?include WixVer.wxi ?>
6
7<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util">
8 <Package Name="!(loc.ShortProduct) v$(var.WixMajorMinor) Core" Language="1033" Manufacturer="!(loc.Company)" Version="$(var.WixMsiProductVersion)" UpgradeCode="3618724B-2523-44F9-A908-866AA619504D" InstallerVersion="200">
9
10 <SoftwareTag Regid="!(loc.Regid)" InstallDirectory="INSTALLFOLDER" />
11
12 <MajorUpgrade DowngradeErrorMessage="A later version of [ProductName] is already installed." />
13
14 <MediaTemplate CabinetTemplate="core{0}.cab" />
15
16 <Property Id="QtExecCmdTimeout" Value="600000" />
17 <CustomAction Id="InstallVSTemplateCommand" Property="WixQuietExecCmdLine" Value="&quot;[VSENVPRODUCT80]\devenv.exe&quot; /setup" />
18 <CustomAction Id="InstallVSTemplate" DllEntry="WixQuietExec" Return="asyncWait" BinaryRef="Wix4UtilCA_X86" />
19
20 <Feature Id="Feature_WiX" Title="WiX Toolset" Level="1">
21 <Component Id="Licensing" Directory="INSTALLFOLDER">
22 <File Id="LICENSE.TXT" Source="LICENSE.TXT" />
23 </Component>
24
25 <Component Id="ProductRegistration" Directory="INSTALLFOLDER">
26 <RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Windows Installer XML\$(var.WixMajorMinor)">
27 <RegistryValue Name="InstallFolder" Value="[INSTALLFOLDER]" Type="string" />
28 </RegistryKey>
29 </Component>
30
31 <Component Id="ProductFamilyRegistration" Directory="INSTALLFOLDER">
32 <RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Windows Installer XML\$(var.WixMajor).x">
33 <RegistryValue Name="v$(var.WixMajorMinor)" Value="[INSTALLFOLDER]" Type="string" />
34 </RegistryKey>
35 </Component>
36
37 <Component Id="ProductInformation" Directory="BinFolder">
38 <RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Windows Installer XML\$(var.WixMajorMinor)">
39 <RegistryValue Name="InstallRoot" Value="[BinFolder]" Type="string" />
40 <RegistryValue Name="ProductVersion" Value="[ProductVersion]" Type="string" />
41 </RegistryKey>
42
43 <RemoveFolder Id="CleanupShortcutFolder" Directory="ShortcutFolder" On="uninstall" />
44 </Component>
45
46 <Component Directory="BinFolder">
47 <File Id="wixtoolset.org.ico" Source="common\wixtoolset.org.ico" />
48 <util:InternetShortcut Id="wixtoolset.org" Directory="ShortcutFolder" Name="WiX Home Page" Target="http://wixtoolset.org/" IconFile="file://[#wixtoolset.org.ico]" />
49 </Component>
50
51 <ComponentGroupRef Id="ToolsetComponents" />
52 <ComponentGroupRef Id="ExtensionComponents" />
53 <ComponentGroupRef Id="LuxComponents" />
54 <ComponentGroupRef Id="DocComponents" />
55 </Feature>
56
57 <FeatureRef Id="Feature_MSBuild" />
58 <FeatureRef Id="Feature_Intellisense2010" />
59 <FeatureRef Id="Feature_Intellisense2012" />
60 <FeatureRef Id="Feature_Intellisense2013" />
61 <FeatureRef Id="Feature_Intellisense2015" />
62 </Package>
63</Wix>
diff --git a/src/test/WixToolsetTest.Converters/TestData/QtExec/v3.wxs b/src/test/WixToolsetTest.Converters/TestData/QtExec/v3.wxs
deleted file mode 100644
index 8d81a758..00000000
--- a/src/test/WixToolsetTest.Converters/TestData/QtExec/v3.wxs
+++ /dev/null
@@ -1,64 +0,0 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<!-- 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. -->
3
4
5
6<?include WixVer.wxi ?>
7
8<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:swid="http://schemas.microsoft.com/wix/TagExtension" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
9 <Product Id="*" Name="!(loc.ShortProduct) v$(var.WixMajorMinor) Core" Language="1033" Manufacturer="!(loc.Company)"
10 Version="$(var.WixMsiProductVersion)" UpgradeCode="3618724B-2523-44F9-A908-866AA619504D">
11 <Package Compressed="yes" InstallerVersion="200" SummaryCodepage="1252" InstallScope="perMachine" />
12 <swid:Tag Regid="!(loc.Regid)" InstallDirectory="INSTALLFOLDER" />
13
14 <MajorUpgrade DowngradeErrorMessage="A later version of [ProductName] is already installed." />
15
16 <MediaTemplate CabinetTemplate="core{0}.cab" />
17
18 <CustomAction Id="InstallVSTemplateCommand" Property="QtExecCmdLine" Value="&quot;[VSENVPRODUCT80]\devenv.exe&quot; /setup" />
19 <CustomAction Id="InstallVSTemplate" BinaryKey="WixCA" DllEntry="CAQuietExec" Return="asyncWait" />
20
21 <Feature Id="Feature_WiX" Title="WiX Toolset" Level="1">
22 <Component Id="Licensing" Directory="INSTALLFOLDER">
23 <File Source="LICENSE.TXT" />
24 </Component>
25
26 <Component Id="ProductRegistration" Directory="INSTALLFOLDER">
27 <RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Windows Installer XML\$(var.WixMajorMinor)">
28 <RegistryValue Name="InstallFolder" Value="[INSTALLFOLDER]" Type="string" />
29 </RegistryKey>
30 </Component>
31
32 <Component Id="ProductFamilyRegistration" Directory="INSTALLFOLDER">
33 <RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Windows Installer XML\$(var.WixMajor).x">
34 <RegistryValue Name="v$(var.WixMajorMinor)" Value="[INSTALLFOLDER]" Type="string" />
35 </RegistryKey>
36 </Component>
37
38 <Component Id="ProductInformation" Directory="BinFolder">
39 <RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Windows Installer XML\$(var.WixMajorMinor)">
40 <RegistryValue Name="InstallRoot" Value="[BinFolder]" Type="string"/>
41 <RegistryValue Name="ProductVersion" Value="[ProductVersion]" Type="string" />
42 </RegistryKey>
43
44 <RemoveFolder Id="CleanupShortcutFolder" Directory="ShortcutFolder" On="uninstall" />
45 </Component>
46
47 <Component Directory="BinFolder">
48 <File Source="common\wixtoolset.org.ico" />
49 <util:InternetShortcut Id="wixtoolset.org" Directory="ShortcutFolder" Name="WiX Home Page" Target="http://wixtoolset.org/" IconFile="file://[#wixtoolset.org.ico]" />
50 </Component>
51
52 <ComponentGroupRef Id="ToolsetComponents" />
53 <ComponentGroupRef Id="ExtensionComponents" />
54 <ComponentGroupRef Id="LuxComponents" />
55 <ComponentGroupRef Id="DocComponents" />
56 </Feature>
57
58 <FeatureRef Id="Feature_MSBuild" />
59 <FeatureRef Id="Feature_Intellisense2010" />
60 <FeatureRef Id="Feature_Intellisense2012" />
61 <FeatureRef Id="Feature_Intellisense2013" />
62 <FeatureRef Id="Feature_Intellisense2015" />
63 </Product>
64</Wix>
diff --git a/src/test/WixToolsetTest.Converters/TestData/QtExec/v4_expected.wxs b/src/test/WixToolsetTest.Converters/TestData/QtExec/v4_expected.wxs
deleted file mode 100644
index f24d3f8f..00000000
--- a/src/test/WixToolsetTest.Converters/TestData/QtExec/v4_expected.wxs
+++ /dev/null
@@ -1,62 +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
4
5<?include WixVer.wxi ?>
6
7<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util">
8 <Package Name="!(loc.ShortProduct) v$(var.WixMajorMinor) Core" Language="1033" Manufacturer="!(loc.Company)" Version="$(var.WixMsiProductVersion)" UpgradeCode="3618724B-2523-44F9-A908-866AA619504D" InstallerVersion="200">
9
10 <SoftwareTag Regid="!(loc.Regid)" InstallDirectory="INSTALLFOLDER" />
11
12 <MajorUpgrade DowngradeErrorMessage="A later version of [ProductName] is already installed." />
13
14 <MediaTemplate CabinetTemplate="core{0}.cab" />
15
16 <CustomAction Id="InstallVSTemplateCommand" Property="WixQuietExecCmdLine" Value="&quot;[VSENVPRODUCT80]\devenv.exe&quot; /setup" />
17 <CustomAction Id="InstallVSTemplate" DllEntry="WixQuietExec" Return="asyncWait" BinaryRef="Wix4UtilCA_X86" />
18
19 <Feature Id="Feature_WiX" Title="WiX Toolset" Level="1">
20 <Component Id="Licensing" Directory="INSTALLFOLDER">
21 <File Id="LICENSE.TXT" Source="LICENSE.TXT" />
22 </Component>
23
24 <Component Id="ProductRegistration" Directory="INSTALLFOLDER">
25 <RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Windows Installer XML\$(var.WixMajorMinor)">
26 <RegistryValue Name="InstallFolder" Value="[INSTALLFOLDER]" Type="string" />
27 </RegistryKey>
28 </Component>
29
30 <Component Id="ProductFamilyRegistration" Directory="INSTALLFOLDER">
31 <RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Windows Installer XML\$(var.WixMajor).x">
32 <RegistryValue Name="v$(var.WixMajorMinor)" Value="[INSTALLFOLDER]" Type="string" />
33 </RegistryKey>
34 </Component>
35
36 <Component Id="ProductInformation" Directory="BinFolder">
37 <RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Windows Installer XML\$(var.WixMajorMinor)">
38 <RegistryValue Name="InstallRoot" Value="[BinFolder]" Type="string" />
39 <RegistryValue Name="ProductVersion" Value="[ProductVersion]" Type="string" />
40 </RegistryKey>
41
42 <RemoveFolder Id="CleanupShortcutFolder" Directory="ShortcutFolder" On="uninstall" />
43 </Component>
44
45 <Component Directory="BinFolder">
46 <File Id="wixtoolset.org.ico" Source="common\wixtoolset.org.ico" />
47 <util:InternetShortcut Id="wixtoolset.org" Directory="ShortcutFolder" Name="WiX Home Page" Target="http://wixtoolset.org/" IconFile="file://[#wixtoolset.org.ico]" />
48 </Component>
49
50 <ComponentGroupRef Id="ToolsetComponents" />
51 <ComponentGroupRef Id="ExtensionComponents" />
52 <ComponentGroupRef Id="LuxComponents" />
53 <ComponentGroupRef Id="DocComponents" />
54 </Feature>
55
56 <FeatureRef Id="Feature_MSBuild" />
57 <FeatureRef Id="Feature_Intellisense2010" />
58 <FeatureRef Id="Feature_Intellisense2012" />
59 <FeatureRef Id="Feature_Intellisense2013" />
60 <FeatureRef Id="Feature_Intellisense2015" />
61 </Package>
62</Wix>
diff --git a/src/test/WixToolsetTest.Converters/TestData/SingleFile/ConvertedSingleFile.wxs b/src/test/WixToolsetTest.Converters/TestData/SingleFile/ConvertedSingleFile.wxs
deleted file mode 100644
index 5bcdaf59..00000000
--- a/src/test/WixToolsetTest.Converters/TestData/SingleFile/ConvertedSingleFile.wxs
+++ /dev/null
@@ -1,59 +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
4
5<?include WixVer.wxi ?>
6
7<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util">
8 <Package Name="!(loc.ShortProduct) v$(var.WixMajorMinor) Core" Language="1033" Manufacturer="!(loc.Company)" Version="$(var.WixMsiProductVersion)" UpgradeCode="3618724B-2523-44F9-A908-866AA619504D" InstallerVersion="200">
9
10 <SoftwareTag Regid="!(loc.Regid)" InstallDirectory="INSTALLFOLDER" />
11
12 <MajorUpgrade DowngradeErrorMessage="A later version of [ProductName] is already installed." />
13
14 <MediaTemplate CabinetTemplate="core{0}.cab" />
15
16 <Feature Id="Feature_WiX" Title="WiX Toolset" Level="1">
17 <Component Id="Licensing" Directory="INSTALLFOLDER">
18 <File Id="LICENSE.TXT" Source="LICENSE.TXT" />
19 </Component>
20
21 <Component Id="ProductRegistration" Directory="INSTALLFOLDER">
22 <RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Windows Installer XML\$(var.WixMajorMinor)">
23 <RegistryValue Name="InstallFolder" Value="[INSTALLFOLDER]" Type="string" />
24 </RegistryKey>
25 </Component>
26
27 <Component Id="ProductFamilyRegistration" Directory="INSTALLFOLDER">
28 <RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Windows Installer XML\$(var.WixMajor).x">
29 <RegistryValue Name="v$(var.WixMajorMinor)" Value="[INSTALLFOLDER]" Type="string" />
30 </RegistryKey>
31 </Component>
32
33 <Component Id="ProductInformation" Directory="BinFolder">
34 <RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Windows Installer XML\$(var.WixMajorMinor)">
35 <RegistryValue Name="InstallRoot" Value="[BinFolder]" Type="string" />
36 <RegistryValue Name="ProductVersion" Value="[ProductVersion]" Type="string" />
37 </RegistryKey>
38
39 <RemoveFolder Id="CleanupShortcutFolder" Directory="ShortcutFolder" On="uninstall" />
40 </Component>
41
42 <Component Directory="BinFolder">
43 <File Id="wixtoolset.org.ico" Source="common\wixtoolset.org.ico" />
44 <util:InternetShortcut Id="wixtoolset.org" Directory="ShortcutFolder" Name="WiX Home Page" Target="http://wixtoolset.org/" IconFile="file://[#wixtoolset.org.ico]" />
45 </Component>
46
47 <ComponentGroupRef Id="ToolsetComponents" />
48 <ComponentGroupRef Id="ExtensionComponents" />
49 <ComponentGroupRef Id="LuxComponents" />
50 <ComponentGroupRef Id="DocComponents" />
51 </Feature>
52
53 <FeatureRef Id="Feature_MSBuild" />
54 <FeatureRef Id="Feature_Intellisense2010" />
55 <FeatureRef Id="Feature_Intellisense2012" />
56 <FeatureRef Id="Feature_Intellisense2013" />
57 <FeatureRef Id="Feature_Intellisense2015" />
58 </Package>
59</Wix>
diff --git a/src/test/WixToolsetTest.Converters/TestData/SingleFile/SingleFile.wxs b/src/test/WixToolsetTest.Converters/TestData/SingleFile/SingleFile.wxs
deleted file mode 100644
index 310ae811..00000000
--- a/src/test/WixToolsetTest.Converters/TestData/SingleFile/SingleFile.wxs
+++ /dev/null
@@ -1,61 +0,0 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<!-- 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. -->
3
4
5
6<?include WixVer.wxi ?>
7
8<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:swid="http://schemas.microsoft.com/wix/TagExtension" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
9 <Product Id="*" Name="!(loc.ShortProduct) v$(var.WixMajorMinor) Core" Language="1033" Manufacturer="!(loc.Company)"
10 Version="$(var.WixMsiProductVersion)" UpgradeCode="3618724B-2523-44F9-A908-866AA619504D">
11 <Package Compressed="yes" InstallerVersion="200" SummaryCodepage="1252" InstallScope="perMachine" />
12 <swid:Tag Regid="!(loc.Regid)" InstallDirectory="INSTALLFOLDER" />
13
14 <MajorUpgrade DowngradeErrorMessage="A later version of [ProductName] is already installed." />
15
16 <MediaTemplate CabinetTemplate="core{0}.cab" />
17
18 <Feature Id="Feature_WiX" Title="WiX Toolset" Level="1">
19 <Component Id="Licensing" Directory="INSTALLFOLDER">
20 <File Source="LICENSE.TXT" />
21 </Component>
22
23 <Component Id="ProductRegistration" Directory="INSTALLFOLDER">
24 <RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Windows Installer XML\$(var.WixMajorMinor)">
25 <RegistryValue Name="InstallFolder" Value="[INSTALLFOLDER]" Type="string" />
26 </RegistryKey>
27 </Component>
28
29 <Component Id="ProductFamilyRegistration" Directory="INSTALLFOLDER">
30 <RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Windows Installer XML\$(var.WixMajor).x">
31 <RegistryValue Name="v$(var.WixMajorMinor)" Value="[INSTALLFOLDER]" Type="string" />
32 </RegistryKey>
33 </Component>
34
35 <Component Id="ProductInformation" Directory="BinFolder">
36 <RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Windows Installer XML\$(var.WixMajorMinor)">
37 <RegistryValue Name="InstallRoot" Value="[BinFolder]" Type="string"/>
38 <RegistryValue Name="ProductVersion" Value="[ProductVersion]" Type="string" />
39 </RegistryKey>
40
41 <RemoveFolder Id="CleanupShortcutFolder" Directory="ShortcutFolder" On="uninstall" />
42 </Component>
43
44 <Component Directory="BinFolder">
45 <File Source="common\wixtoolset.org.ico" />
46 <util:InternetShortcut Id="wixtoolset.org" Directory="ShortcutFolder" Name="WiX Home Page" Target="http://wixtoolset.org/" IconFile="file://[#wixtoolset.org.ico]" />
47 </Component>
48
49 <ComponentGroupRef Id="ToolsetComponents" />
50 <ComponentGroupRef Id="ExtensionComponents" />
51 <ComponentGroupRef Id="LuxComponents" />
52 <ComponentGroupRef Id="DocComponents" />
53 </Feature>
54
55 <FeatureRef Id="Feature_MSBuild" />
56 <FeatureRef Id="Feature_Intellisense2010" />
57 <FeatureRef Id="Feature_Intellisense2012" />
58 <FeatureRef Id="Feature_Intellisense2013" />
59 <FeatureRef Id="Feature_Intellisense2015" />
60 </Product>
61</Wix>
diff --git a/src/test/WixToolsetTest.Converters/UtilExtensionFixture.cs b/src/test/WixToolsetTest.Converters/UtilExtensionFixture.cs
deleted file mode 100644
index 10450c68..00000000
--- a/src/test/WixToolsetTest.Converters/UtilExtensionFixture.cs
+++ /dev/null
@@ -1,190 +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
3namespace 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 UtilExtensionFixture : BaseConverterFixture
13 {
14 [Fact]
15 public void FixCloseAppsCondition()
16 {
17 var parse = String.Join(Environment.NewLine,
18 "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:util='http://schemas.microsoft.com/wix/UtilExtension'>",
19 " <Fragment>",
20 " <util:CloseApplication Id='EndApp' Target='example.exe'>",
21 " a&lt;>b",
22 " </util:CloseApplication>",
23 " </Fragment>",
24 "</Wix>");
25
26 var expected = new[]
27 {
28 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\" xmlns:util=\"http://wixtoolset.org/schemas/v4/wxs/util\">",
29 " <Fragment>",
30 " <util:CloseApplication Id=\"EndApp\" Target=\"example.exe\" Condition=\"a&lt;&gt;b\" />",
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&lt;>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&lt;&gt;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 [Fact]
81 public void WarnsOnAllRegistryValueSearches()
82 {
83 var parse = String.Join(Environment.NewLine,
84 "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:util='http://schemas.microsoft.com/wix/UtilExtension'>",
85 " <Fragment>",
86 " <util:RegistrySearch Id='RegValue' Root='HKLM' Key='Converter' Variable='Test' />",
87 " <util:RegistrySearch Id='RegValue2' Root='HKLM' Key='Converter' Variable='Test' Result='value' />",
88 " <util:RegistrySearch Id='RegValue3' Root='HKLM' Key='Converter' Variable='Test' Result='exists' />",
89 " </Fragment>",
90 "</Wix>");
91
92 var expected = new[]
93 {
94 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\" xmlns:util=\"http://wixtoolset.org/schemas/v4/wxs/util\">",
95 " <Fragment>",
96 " <util:RegistrySearch Id=\"RegValue\" Root=\"HKLM\" Key=\"Converter\" Variable=\"Test\" />",
97 " <util:RegistrySearch Id=\"RegValue2\" Root=\"HKLM\" Key=\"Converter\" Variable=\"Test\" Result=\"value\" />",
98 " <util:RegistrySearch Id=\"RegValue3\" Root=\"HKLM\" Key=\"Converter\" Variable=\"Test\" Result=\"exists\" />",
99 " </Fragment>",
100 "</Wix>"
101 };
102
103 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
104
105 var messaging = new MockMessaging();
106 var converter = new WixConverter(messaging, 2, null, null);
107
108 var errors = converter.ConvertDocument(document);
109 Assert.Equal(4, errors);
110
111 var actualLines = UnformattedDocumentLines(document);
112 WixAssert.CompareLineByLine(expected, actualLines);
113 }
114
115
116 [Fact]
117 public void FixXmlConfigValueCData()
118 {
119 var parse = String.Join(Environment.NewLine,
120 "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:util='http://schemas.microsoft.com/wix/UtilExtension'>",
121 " <Fragment>",
122 " <util:XmlConfig Id='Change' ElementPath='book'>",
123 " <![CDATA[a<>b]]>",
124 " </util:XmlConfig>",
125 " </Fragment>",
126 "</Wix>");
127
128 var expected = new[]
129 {
130 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\" xmlns:util=\"http://wixtoolset.org/schemas/v4/wxs/util\">",
131 " <Fragment>",
132 " <util:XmlConfig Id=\"Change\" ElementPath=\"book\" Value=\"a&lt;&gt;b\" />",
133 " </Fragment>",
134 "</Wix>"
135 };
136
137 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
138
139 var messaging = new MockMessaging();
140 var converter = new WixConverter(messaging, 2, null, null);
141
142 var errors = converter.ConvertDocument(document);
143 Assert.Equal(3, errors);
144
145 var actualLines = UnformattedDocumentLines(document);
146 WixAssert.CompareLineByLine(expected, actualLines);
147 }
148
149 [Fact]
150 public void FixQueryOsPropertyRefs()
151 {
152 var parse = String.Join(Environment.NewLine,
153 "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:util='http://schemas.microsoft.com/wix/UtilExtension'>",
154 " <Fragment>",
155 " <PropertyRef Id=\"WIX_SUITE_ENTERPRISE\" />",
156 " <PropertyRef Id=\"WIX_DIR_COMMON_DOCUMENTS\" />",
157 " <CustomActionRef Id=\"WixFailWhenDeferred\" />",
158 " <UI>",
159 " <PropertyRef Id=\"WIX_ACCOUNT_LOCALSERVICE\" />",
160 " </UI>",
161 " </Fragment>",
162 "</Wix>");
163
164 var expected = new[]
165 {
166 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\" xmlns:util=\"http://wixtoolset.org/schemas/v4/wxs/util\">",
167 " <Fragment>",
168 " <util:QueryWindowsSuiteInfo />",
169 " <util:QueryWindowsDirectories />",
170 " <util:FailWhenDeferred />",
171 " <UI>",
172 " <util:QueryWindowsWellKnownSIDs />",
173 " </UI>",
174 " </Fragment>",
175 "</Wix>"
176 };
177
178 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
179
180 var messaging = new MockMessaging();
181 var converter = new WixConverter(messaging, 2, null, null);
182
183 var errors = converter.ConvertDocument(document);
184 Assert.Equal(6, errors);
185
186 var actualLines = UnformattedDocumentLines(document);
187 WixAssert.CompareLineByLine(expected, actualLines);
188 }
189 }
190}
diff --git a/src/test/WixToolsetTest.Converters/VariableFixture.cs b/src/test/WixToolsetTest.Converters/VariableFixture.cs
deleted file mode 100644
index b7b7388f..00000000
--- a/src/test/WixToolsetTest.Converters/VariableFixture.cs
+++ /dev/null
@@ -1,86 +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
3namespace 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 VariableFixture : BaseConverterFixture
13 {
14 [Fact]
15 public void FixFormattedType()
16 {
17 var parse = String.Join(Environment.NewLine,
18 "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>",
19 " <Fragment>",
20 " <Variable Name='ExplicitString' Type='string' Value='explicit' />",
21 " <Variable Name='ImplicitNumber' Value='42' />",
22 " <Variable Name='ImplicitString' Value='implicit' />",
23 " <Variable Name='ImplicitVersion' Value='v2' />",
24 " <Variable Name='NoTypeOrValue' />",
25 " </Fragment>",
26 "</Wix>");
27
28 var expected = new[]
29 {
30 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
31 " <Fragment>",
32 " <Variable Name=\"ExplicitString\" Type=\"formatted\" Value=\"explicit\" />",
33 " <Variable Name=\"ImplicitNumber\" Value=\"42\" />",
34 " <Variable Name=\"ImplicitString\" Value=\"implicit\" Type=\"formatted\" />",
35 " <Variable Name=\"ImplicitVersion\" Value=\"v2\" />",
36 " <Variable Name=\"NoTypeOrValue\" />",
37 " </Fragment>",
38 "</Wix>"
39 };
40
41 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
42
43 var messaging = new MockMessaging();
44 var converter = new WixConverter(messaging, 2, null, null);
45
46 var errors = converter.ConvertDocument(document);
47 Assert.Equal(3, errors);
48
49 var actualLines = UnformattedDocumentLines(document);
50 WixAssert.CompareLineByLine(expected, actualLines);
51 }
52
53 [Fact]
54 public void DoesntFixFormattedTypeFromV4()
55 {
56 var parse = String.Join(Environment.NewLine,
57 "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>",
58 " <Fragment>",
59 " <Variable Name='ImplicitString' Value='implicit' />",
60 " <Variable Name='ExplicitString' Type='string' Value='explicit' />",
61 " </Fragment>",
62 "</Wix>");
63
64 var expected = new[]
65 {
66 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
67 " <Fragment>",
68 " <Variable Name=\"ImplicitString\" Value=\"implicit\" />",
69 " <Variable Name=\"ExplicitString\" Type=\"string\" Value=\"explicit\" />",
70 " </Fragment>",
71 "</Wix>"
72 };
73
74 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
75
76 var messaging = new MockMessaging();
77 var converter = new WixConverter(messaging, 2, null, null);
78
79 var errors = converter.ConvertDocument(document);
80 Assert.Equal(0, errors);
81
82 var actualLines = UnformattedDocumentLines(document);
83 WixAssert.CompareLineByLine(expected, actualLines);
84 }
85 }
86}
diff --git a/src/test/WixToolsetTest.Converters/Wix4ConversionFixture.cs b/src/test/WixToolsetTest.Converters/Wix4ConversionFixture.cs
deleted file mode 100644
index 16a68895..00000000
--- a/src/test/WixToolsetTest.Converters/Wix4ConversionFixture.cs
+++ /dev/null
@@ -1,54 +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
3namespace 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 Wix4ConversionFixture : BaseConverterFixture
13 {
14 [Fact]
15 public void DoesNotAddFileId()
16 {
17 var parse = String.Join(Environment.NewLine,
18 "<?xml version=\"1.0\" encoding=\"utf-16\"?>",
19 "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>",
20 " <Fragment>",
21 " <ComponentGroup Id='ProductComponents' Directory='INSTALLFOLDER'>",
22 " <Component>",
23 " <File Source='example.txt' />",
24 " </Component>",
25 " </ComponentGroup>",
26 " </Fragment>",
27 "</Wix>");
28
29 var expected = new[]
30 {
31 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
32 " <Fragment>",
33 " <ComponentGroup Id=\"ProductComponents\" Directory=\"INSTALLFOLDER\">",
34 " <Component>",
35 " <File Source=\"example.txt\" />",
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(1, errors);
49
50 var actualLines = UnformattedDocumentLines(document);
51 WixAssert.CompareLineByLine(expected, actualLines);
52 }
53 }
54}
diff --git a/src/test/WixToolsetTest.Converters/WixToolsetTest.Converters.csproj b/src/test/WixToolsetTest.Converters/WixToolsetTest.Converters.csproj
deleted file mode 100644
index 29b02b95..00000000
--- a/src/test/WixToolsetTest.Converters/WixToolsetTest.Converters.csproj
+++ /dev/null
@@ -1,31 +0,0 @@
1<?xml version="1.0" encoding="utf-8"?>
2<!-- 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. -->
3
4<Project Sdk="Microsoft.NET.Sdk">
5 <PropertyGroup>
6 <TargetFramework>netcoreapp3.1</TargetFramework>
7 <IsPackable>false</IsPackable>
8 </PropertyGroup>
9
10 <ItemGroup>
11 <Content Include="TestData\**" CopyToOutputDirectory="PreserveNewest" />
12 </ItemGroup>
13
14 <ItemGroup>
15 <ProjectReference Include="..\..\WixToolset.Converters\WixToolset.Converters.csproj" />
16 </ItemGroup>
17
18 <ItemGroup>
19 <PackageReference Include="WixBuildTools.TestSupport" Version="4.0.*" />
20 <PackageReference Include="WixToolset.Core" Version="4.0.*" />
21 <PackageReference Include="WixToolset.Core.Burn" Version="4.0.*" />
22 <PackageReference Include="WixToolset.Core.TestPackage" Version="4.0.*" />
23 <PackageReference Include="WixToolset.Core.WindowsInstaller" Version="4.0.*" />
24 </ItemGroup>
25
26 <ItemGroup>
27 <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.3" />
28 <PackageReference Include="xunit" Version="2.4.1" />
29 <PackageReference Include="xunit.runner.visualstudio" Version="2.4.3" PrivateAssets="All" />
30 </ItemGroup>
31</Project>