aboutsummaryrefslogtreecommitdiff
path: root/src/tools/test/WixToolsetTest.Heat/HeatFixture.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/test/WixToolsetTest.Heat/HeatFixture.cs')
-rw-r--r--src/tools/test/WixToolsetTest.Heat/HeatFixture.cs224
1 files changed, 0 insertions, 224 deletions
diff --git a/src/tools/test/WixToolsetTest.Heat/HeatFixture.cs b/src/tools/test/WixToolsetTest.Heat/HeatFixture.cs
deleted file mode 100644
index c5f3df74..00000000
--- a/src/tools/test/WixToolsetTest.Heat/HeatFixture.cs
+++ /dev/null
@@ -1,224 +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.Heat
4{
5 using System.IO;
6 using System.Linq;
7 using Microsoft.VisualStudio.TestTools.UnitTesting;
8 using WixInternal.MSTestSupport;
9
10 [TestClass]
11 public class HeatFixture
12 {
13 [TestMethod]
14 public void CanHarvestSimpleDirectory()
15 {
16 var folder = TestData.Get("TestData", "SingleFile");
17
18 using (var fs = new DisposableFileSystem())
19 {
20 var outputPath = Path.Combine(fs.GetFolder(), "out.wxs");
21
22 var args = new[]
23 {
24 "dir", folder,
25 "-o", outputPath
26 };
27
28 var result = HeatRunner.Execute(args);
29 result.AssertSuccess();
30
31 var wxs = File.ReadAllLines(outputPath).Select(s => s.Replace("\"", "'")).ToArray();
32 WixAssert.CompareLineByLine(new[]
33 {
34 "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>",
35 " <Fragment>",
36 " <StandardDirectory Id='TARGETDIR'>",
37 " <Directory Id='dirwsJn0Cqs9KdlDSFdQsu9ygYvMF8' Name='SingleFile' />",
38 " </StandardDirectory>",
39 " </Fragment>",
40 " <Fragment>",
41 " <DirectoryRef Id='dirwsJn0Cqs9KdlDSFdQsu9ygYvMF8'>",
42 " <Component Id='cmp0i3dThrp4nheCteEmXvHxBDa_VE' Guid='PUT-GUID-HERE'>",
43 " <File Id='filziMcXYgrmcbVF8PuTUfIB9Vgqo0' KeyPath='yes' Source='SourceDir\\a.txt' />",
44 " </Component>",
45 " </DirectoryRef>",
46 " </Fragment>",
47 "</Wix>",
48 }, wxs);
49 }
50 }
51
52 [TestMethod]
53 public void CanHarvestSimpleDirectoryToComponentGroup()
54 {
55 var folder = TestData.Get("TestData", "SingleFile");
56
57 using (var fs = new DisposableFileSystem())
58 {
59 var outputPath = Path.Combine(fs.GetFolder(), "out.wxs");
60
61 var args = new[]
62 {
63 "dir", folder,
64 "-cg", "CG1",
65 "-o", outputPath
66 };
67
68 var result = HeatRunner.Execute(args);
69 result.AssertSuccess();
70
71 var wxs = File.ReadAllLines(outputPath).Select(s => s.Replace("\"", "'")).ToArray();
72 WixAssert.CompareLineByLine(new[]
73 {
74 "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>",
75 " <Fragment>",
76 " <StandardDirectory Id='TARGETDIR'>",
77 " <Directory Id='dirwsJn0Cqs9KdlDSFdQsu9ygYvMF8' Name='SingleFile' />",
78 " </StandardDirectory>",
79 " </Fragment>",
80 " <Fragment>",
81 " <ComponentGroup Id='CG1'>",
82 " <Component Id='cmp0i3dThrp4nheCteEmXvHxBDa_VE' Directory='dirwsJn0Cqs9KdlDSFdQsu9ygYvMF8' Guid='PUT-GUID-HERE'>",
83 " <File Id='filziMcXYgrmcbVF8PuTUfIB9Vgqo0' KeyPath='yes' Source='SourceDir\\a.txt' />",
84 " </Component>",
85 " </ComponentGroup>",
86 " </Fragment>",
87 "</Wix>",
88 }, wxs);
89 }
90 }
91
92 [TestMethod]
93 public void CanHarvestSimpleDirectoryToInstallFolder()
94 {
95 var folder = TestData.Get("TestData", "SingleFile");
96
97 using (var fs = new DisposableFileSystem())
98 {
99 var outputPath = Path.Combine(fs.GetFolder(), "out.wxs");
100
101 var args = new[]
102 {
103 "dir", folder,
104 "-dr", "INSTALLFOLDER",
105 "-indent", "2",
106 "-o", outputPath
107 };
108
109 var result = HeatRunner.Execute(args);
110 result.AssertSuccess();
111
112 var wxs = File.ReadAllLines(outputPath).Select(s => s.Replace("\"", "'")).ToArray();
113 WixAssert.CompareLineByLine(new[]
114 {
115 "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>",
116 " <Fragment>",
117 " <DirectoryRef Id='INSTALLFOLDER'>",
118 " <Directory Id='dirlooNEIrtEBL2w_RhFEIgiKcUlxE' Name='SingleFile' />",
119 " </DirectoryRef>",
120 " </Fragment>",
121 " <Fragment>",
122 " <DirectoryRef Id='dirlooNEIrtEBL2w_RhFEIgiKcUlxE'>",
123 " <Component Id='cmpxHVF6oXohc0EWgRphmYZvw5.GGU' Guid='PUT-GUID-HERE'>",
124 " <File Id='filk_7KUAfL4VfzxSRsGFf_XOBHln0' KeyPath='yes' Source='SourceDir\\a.txt' />",
125 " </Component>",
126 " </DirectoryRef>",
127 " </Fragment>",
128 "</Wix>",
129 }, wxs);
130 }
131 }
132
133 [TestMethod]
134 public void CanHarvestFile()
135 {
136 var folder = TestData.Get("TestData", "SingleFile");
137
138 using (var fs = new DisposableFileSystem())
139 {
140 var outputPath = Path.Combine(fs.GetFolder(), "out.wxs");
141
142 var args = new[]
143 {
144 "file", Path.Combine(folder, "a.txt"),
145 "-cg", "GroupA",
146 "-dr", "ProgramFiles6432Folder",
147 "-o", outputPath
148
149 };
150
151 var result = HeatRunner.Execute(args);
152 result.AssertSuccess();
153
154 var wxs = File.ReadAllLines(outputPath).Select(s => s.Replace("\"", "'")).ToArray();
155 WixAssert.CompareLineByLine(new[]
156 {
157 "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>",
158 " <Fragment>",
159 " <StandardDirectory Id='ProgramFiles6432Folder'>",
160 " <Directory Id='dirl6r_Yc0gvMUEUVe5rioOOIIasoU' Name='SingleFile' />",
161 " </StandardDirectory>",
162 " </Fragment>",
163 " <Fragment>",
164 " <ComponentGroup Id='GroupA'>",
165 " <Component Id='cmpfBcW61_XzosRWK3EzUTBtJrcJD8' Directory='dirl6r_Yc0gvMUEUVe5rioOOIIasoU' Guid='PUT-GUID-HERE'>",
166 " <File Id='filKrZgaIOSKpNZXFnezZc9X.LKGpw' KeyPath='yes' Source='SourceDir\\SingleFile\\a.txt' />",
167 " </Component>",
168 " </ComponentGroup>",
169 " </Fragment>",
170 "</Wix>",
171 }, wxs);
172 }
173 }
174
175 [TestMethod]
176 public void CanHarvestRegistry()
177 {
178 var folder = TestData.Get("TestData", "RegFile");
179
180 using (var fs = new DisposableFileSystem())
181 {
182 var outputPath = Path.Combine(fs.GetFolder(), "out.wxs");
183
184 var args = new[]
185 {
186 "reg", Path.Combine(folder, "input.reg"),
187 "-o", outputPath
188 };
189
190 var result = HeatRunner.Execute(args);
191 result.AssertSuccess();
192
193 var actual = File.ReadAllLines(outputPath).Select(s => s.Replace("\"", "'")).ToArray();
194 var expected = File.ReadAllLines(Path.Combine(folder, "Expected.wxs")).Select(s => s.Replace("\"", "'")).ToArray();
195 WixAssert.CompareLineByLine(expected, actual);
196 }
197 }
198
199 [TestMethod]
200 public void CanHarvestRegistryIntoComponentGroup()
201 {
202 var folder = TestData.Get("TestData", "RegFile");
203
204 using (var fs = new DisposableFileSystem())
205 {
206 var outputPath = Path.Combine(fs.GetFolder(), "out.wxs");
207
208 var args = new[]
209 {
210 "reg", Path.Combine(folder, "input.reg"),
211 "-cg", "CG1",
212 "-o", outputPath
213 };
214
215 var result = HeatRunner.Execute(args);
216 result.AssertSuccess();
217
218 var actual = File.ReadAllLines(outputPath).Select(s => s.Replace("\"", "'")).ToArray();
219 var expected = File.ReadAllLines(Path.Combine(folder, "ExpectedWithComponentGroup.wxs")).Select(s => s.Replace("\"", "'")).ToArray();
220 WixAssert.CompareLineByLine(expected, actual);
221 }
222 }
223 }
224}