diff options
Diffstat (limited to 'src/tools/test/WixToolsetTest.Heat/HeatFixture.cs')
-rw-r--r-- | src/tools/test/WixToolsetTest.Heat/HeatFixture.cs | 111 |
1 files changed, 99 insertions, 12 deletions
diff --git a/src/tools/test/WixToolsetTest.Heat/HeatFixture.cs b/src/tools/test/WixToolsetTest.Heat/HeatFixture.cs index 388d4dc0..d517e209 100644 --- a/src/tools/test/WixToolsetTest.Heat/HeatFixture.cs +++ b/src/tools/test/WixToolsetTest.Heat/HeatFixture.cs | |||
@@ -30,7 +30,6 @@ namespace WixToolsetTest.Heat | |||
30 | var wxs = File.ReadAllLines(outputPath).Select(s => s.Replace("\"", "'")).ToArray(); | 30 | var wxs = File.ReadAllLines(outputPath).Select(s => s.Replace("\"", "'")).ToArray(); |
31 | WixAssert.CompareLineByLine(new[] | 31 | WixAssert.CompareLineByLine(new[] |
32 | { | 32 | { |
33 | "<?xml version='1.0' encoding='utf-8'?>", | ||
34 | "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>", | 33 | "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>", |
35 | " <Fragment>", | 34 | " <Fragment>", |
36 | " <StandardDirectory Id='TARGETDIR'>", | 35 | " <StandardDirectory Id='TARGETDIR'>", |
@@ -50,7 +49,7 @@ namespace WixToolsetTest.Heat | |||
50 | } | 49 | } |
51 | 50 | ||
52 | [Fact] | 51 | [Fact] |
53 | public void CanHarvestSimpleDirectoryToInstallFolder() | 52 | public void CanHarvestSimpleDirectoryToComponentGroup() |
54 | { | 53 | { |
55 | var folder = TestData.Get("TestData", "SingleFile"); | 54 | var folder = TestData.Get("TestData", "SingleFile"); |
56 | 55 | ||
@@ -61,7 +60,7 @@ namespace WixToolsetTest.Heat | |||
61 | var args = new[] | 60 | var args = new[] |
62 | { | 61 | { |
63 | "dir", folder, | 62 | "dir", folder, |
64 | "-dr", "INSTALLFOLDER", | 63 | "-cg", "CG1", |
65 | "-o", outputPath | 64 | "-o", outputPath |
66 | }; | 65 | }; |
67 | 66 | ||
@@ -71,19 +70,18 @@ namespace WixToolsetTest.Heat | |||
71 | var wxs = File.ReadAllLines(outputPath).Select(s => s.Replace("\"", "'")).ToArray(); | 70 | var wxs = File.ReadAllLines(outputPath).Select(s => s.Replace("\"", "'")).ToArray(); |
72 | WixAssert.CompareLineByLine(new[] | 71 | WixAssert.CompareLineByLine(new[] |
73 | { | 72 | { |
74 | "<?xml version='1.0' encoding='utf-8'?>", | ||
75 | "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>", | 73 | "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>", |
76 | " <Fragment>", | 74 | " <Fragment>", |
77 | " <DirectoryRef Id='INSTALLFOLDER'>", | 75 | " <StandardDirectory Id='TARGETDIR'>", |
78 | " <Directory Id='dirlooNEIrtEBL2w_RhFEIgiKcUlxE' Name='SingleFile' />", | 76 | " <Directory Id='dirwsJn0Cqs9KdlDSFdQsu9ygYvMF8' Name='SingleFile' />", |
79 | " </DirectoryRef>", | 77 | " </StandardDirectory>", |
80 | " </Fragment>", | 78 | " </Fragment>", |
81 | " <Fragment>", | 79 | " <Fragment>", |
82 | " <DirectoryRef Id='dirlooNEIrtEBL2w_RhFEIgiKcUlxE'>", | 80 | " <ComponentGroup Id='CG1'>", |
83 | " <Component Id='cmpxHVF6oXohc0EWgRphmYZvw5.GGU' Guid='PUT-GUID-HERE'>", | 81 | " <Component Id='cmp0i3dThrp4nheCteEmXvHxBDa_VE' Directory='dirwsJn0Cqs9KdlDSFdQsu9ygYvMF8' Guid='PUT-GUID-HERE'>", |
84 | " <File Id='filk_7KUAfL4VfzxSRsGFf_XOBHln0' KeyPath='yes' Source='SourceDir\\a.txt' />", | 82 | " <File Id='filziMcXYgrmcbVF8PuTUfIB9Vgqo0' KeyPath='yes' Source='SourceDir\\a.txt' />", |
85 | " </Component>", | 83 | " </Component>", |
86 | " </DirectoryRef>", | 84 | " </ComponentGroup>", |
87 | " </Fragment>", | 85 | " </Fragment>", |
88 | "</Wix>", | 86 | "</Wix>", |
89 | }, wxs); | 87 | }, wxs); |
@@ -91,6 +89,47 @@ namespace WixToolsetTest.Heat | |||
91 | } | 89 | } |
92 | 90 | ||
93 | [Fact] | 91 | [Fact] |
92 | public void CanHarvestSimpleDirectoryToInstallFolder() | ||
93 | { | ||
94 | var folder = TestData.Get("TestData", "SingleFile"); | ||
95 | |||
96 | using (var fs = new DisposableFileSystem()) | ||
97 | { | ||
98 | var outputPath = Path.Combine(fs.GetFolder(), "out.wxs"); | ||
99 | |||
100 | var args = new[] | ||
101 | { | ||
102 | "dir", folder, | ||
103 | "-dr", "INSTALLFOLDER", | ||
104 | "-indent", "2", | ||
105 | "-o", outputPath | ||
106 | }; | ||
107 | |||
108 | var result = HeatRunner.Execute(args); | ||
109 | result.AssertSuccess(); | ||
110 | |||
111 | var wxs = File.ReadAllLines(outputPath).Select(s => s.Replace("\"", "'")).ToArray(); | ||
112 | WixAssert.CompareLineByLine(new[] | ||
113 | { | ||
114 | "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>", | ||
115 | " <Fragment>", | ||
116 | " <DirectoryRef Id='INSTALLFOLDER'>", | ||
117 | " <Directory Id='dirlooNEIrtEBL2w_RhFEIgiKcUlxE' Name='SingleFile' />", | ||
118 | " </DirectoryRef>", | ||
119 | " </Fragment>", | ||
120 | " <Fragment>", | ||
121 | " <DirectoryRef Id='dirlooNEIrtEBL2w_RhFEIgiKcUlxE'>", | ||
122 | " <Component Id='cmpxHVF6oXohc0EWgRphmYZvw5.GGU' Guid='PUT-GUID-HERE'>", | ||
123 | " <File Id='filk_7KUAfL4VfzxSRsGFf_XOBHln0' KeyPath='yes' Source='SourceDir\\a.txt' />", | ||
124 | " </Component>", | ||
125 | " </DirectoryRef>", | ||
126 | " </Fragment>", | ||
127 | "</Wix>", | ||
128 | }, wxs); | ||
129 | } | ||
130 | } | ||
131 | |||
132 | [Fact] | ||
94 | public void CanHarvestFile() | 133 | public void CanHarvestFile() |
95 | { | 134 | { |
96 | var folder = TestData.Get("TestData", "SingleFile"); | 135 | var folder = TestData.Get("TestData", "SingleFile"); |
@@ -114,7 +153,6 @@ namespace WixToolsetTest.Heat | |||
114 | var wxs = File.ReadAllLines(outputPath).Select(s => s.Replace("\"", "'")).ToArray(); | 153 | var wxs = File.ReadAllLines(outputPath).Select(s => s.Replace("\"", "'")).ToArray(); |
115 | WixAssert.CompareLineByLine(new[] | 154 | WixAssert.CompareLineByLine(new[] |
116 | { | 155 | { |
117 | "<?xml version='1.0' encoding='utf-8'?>", | ||
118 | "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>", | 156 | "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>", |
119 | " <Fragment>", | 157 | " <Fragment>", |
120 | " <StandardDirectory Id='ProgramFiles6432Folder'>", | 158 | " <StandardDirectory Id='ProgramFiles6432Folder'>", |
@@ -132,5 +170,54 @@ namespace WixToolsetTest.Heat | |||
132 | }, wxs); | 170 | }, wxs); |
133 | } | 171 | } |
134 | } | 172 | } |
173 | |||
174 | [Fact] | ||
175 | public void CanHarvestRegistry() | ||
176 | { | ||
177 | var folder = TestData.Get("TestData", "RegFile"); | ||
178 | |||
179 | using (var fs = new DisposableFileSystem()) | ||
180 | { | ||
181 | var outputPath = Path.Combine(fs.GetFolder(), "out.wxs"); | ||
182 | |||
183 | var args = new[] | ||
184 | { | ||
185 | "reg", Path.Combine(folder, "input.reg"), | ||
186 | "-o", outputPath | ||
187 | }; | ||
188 | |||
189 | var result = HeatRunner.Execute(args); | ||
190 | result.AssertSuccess(); | ||
191 | |||
192 | var actual = File.ReadAllLines(outputPath).Select(s => s.Replace("\"", "'")).ToArray(); | ||
193 | var expected = File.ReadAllLines(Path.Combine(folder, "Expected.wxs")).Select(s => s.Replace("\"", "'")).ToArray(); | ||
194 | WixAssert.CompareLineByLine(expected, actual); | ||
195 | } | ||
196 | } | ||
197 | |||
198 | [Fact] | ||
199 | public void CanHarvestRegistryIntoComponentGroup() | ||
200 | { | ||
201 | var folder = TestData.Get("TestData", "RegFile"); | ||
202 | |||
203 | using (var fs = new DisposableFileSystem()) | ||
204 | { | ||
205 | var outputPath = Path.Combine(fs.GetFolder(), "out.wxs"); | ||
206 | |||
207 | var args = new[] | ||
208 | { | ||
209 | "reg", Path.Combine(folder, "input.reg"), | ||
210 | "-cg", "CG1", | ||
211 | "-o", outputPath | ||
212 | }; | ||
213 | |||
214 | var result = HeatRunner.Execute(args); | ||
215 | result.AssertSuccess(); | ||
216 | |||
217 | var actual = File.ReadAllLines(outputPath).Select(s => s.Replace("\"", "'")).ToArray(); | ||
218 | var expected = File.ReadAllLines(Path.Combine(folder, "ExpectedWithComponentGroup.wxs")).Select(s => s.Replace("\"", "'")).ToArray(); | ||
219 | WixAssert.CompareLineByLine(expected, actual); | ||
220 | } | ||
221 | } | ||
135 | } | 222 | } |
136 | } | 223 | } |