diff options
Diffstat (limited to 'src/test/WixToolsetTest.CoreIntegration/CustomTableFixture.cs')
-rw-r--r-- | src/test/WixToolsetTest.CoreIntegration/CustomTableFixture.cs | 234 |
1 files changed, 0 insertions, 234 deletions
diff --git a/src/test/WixToolsetTest.CoreIntegration/CustomTableFixture.cs b/src/test/WixToolsetTest.CoreIntegration/CustomTableFixture.cs deleted file mode 100644 index ee93b03a..00000000 --- a/src/test/WixToolsetTest.CoreIntegration/CustomTableFixture.cs +++ /dev/null | |||
@@ -1,234 +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 | namespace WixToolsetTest.CoreIntegration | ||
4 | { | ||
5 | using System.IO; | ||
6 | using System.Xml.Linq; | ||
7 | using WixBuildTools.TestSupport; | ||
8 | using WixToolset.Core.TestPackage; | ||
9 | using Xunit; | ||
10 | |||
11 | public class CustomTableFixture | ||
12 | { | ||
13 | [Fact] | ||
14 | public void PopulatesCustomTable1() | ||
15 | { | ||
16 | var folder = TestData.Get(@"TestData"); | ||
17 | |||
18 | using (var fs = new DisposableFileSystem()) | ||
19 | { | ||
20 | var baseFolder = fs.GetFolder(); | ||
21 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
22 | var msiPath = Path.Combine(baseFolder, @"bin\test.msi"); | ||
23 | |||
24 | var result = WixRunner.Execute(new[] | ||
25 | { | ||
26 | "build", | ||
27 | Path.Combine(folder, "CustomTable", "CustomTable.wxs"), | ||
28 | Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), | ||
29 | Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), | ||
30 | "-bindpath", Path.Combine(folder, "SingleFile", "data"), | ||
31 | "-intermediateFolder", intermediateFolder, | ||
32 | "-o", msiPath | ||
33 | }); | ||
34 | |||
35 | result.AssertSuccess(); | ||
36 | |||
37 | Assert.True(File.Exists(msiPath)); | ||
38 | var results = Query.QueryDatabase(msiPath, new[] { "CustomTable1" }); | ||
39 | Assert.Equal(new[] | ||
40 | { | ||
41 | "CustomTable1:Row1\ttest.txt", | ||
42 | "CustomTable1:Row2\ttest.txt", | ||
43 | }, results); | ||
44 | } | ||
45 | } | ||
46 | |||
47 | [Fact] | ||
48 | public void PopulatesCustomTableWithLocalization() | ||
49 | { | ||
50 | var folder = TestData.Get(@"TestData"); | ||
51 | |||
52 | using (var fs = new DisposableFileSystem()) | ||
53 | { | ||
54 | var baseFolder = fs.GetFolder(); | ||
55 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
56 | var msiPath = Path.Combine(baseFolder, @"bin\test.msi"); | ||
57 | |||
58 | var result = WixRunner.Execute(new[] | ||
59 | { | ||
60 | "build", | ||
61 | Path.Combine(folder, "CustomTable", "LocalizedCustomTable.wxs"), | ||
62 | Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), | ||
63 | Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), | ||
64 | "-loc", Path.Combine(folder, "CustomTable", "LocalizedCustomTable.en-us.wxl"), | ||
65 | "-bindpath", Path.Combine(folder, "SingleFile", "data"), | ||
66 | "-intermediateFolder", intermediateFolder, | ||
67 | "-o", msiPath | ||
68 | }); | ||
69 | |||
70 | result.AssertSuccess(); | ||
71 | |||
72 | Assert.True(File.Exists(msiPath)); | ||
73 | var results = Query.QueryDatabase(msiPath, new[] { "CustomTableLocalized" }); | ||
74 | Assert.Equal(new[] | ||
75 | { | ||
76 | "CustomTableLocalized:Row1\tThis is row one", | ||
77 | "CustomTableLocalized:Row2\tThis is row two", | ||
78 | }, results); | ||
79 | } | ||
80 | } | ||
81 | |||
82 | [Fact] | ||
83 | public void PopulatesCustomTableWithFilePath() | ||
84 | { | ||
85 | var folder = TestData.Get(@"TestData"); | ||
86 | |||
87 | using (var fs = new DisposableFileSystem()) | ||
88 | { | ||
89 | var baseFolder = fs.GetFolder(); | ||
90 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
91 | var msiPath = Path.Combine(baseFolder, @"bin\test.msi"); | ||
92 | |||
93 | var result = WixRunner.Execute(new[] | ||
94 | { | ||
95 | "build", | ||
96 | Path.Combine(folder, "CustomTable", "CustomTableWithFile.wxs"), | ||
97 | Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), | ||
98 | Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), | ||
99 | "-bindpath", Path.Combine(folder, "CustomTable", "data"), | ||
100 | "-intermediateFolder", intermediateFolder, | ||
101 | "-o", msiPath | ||
102 | }); | ||
103 | |||
104 | result.AssertSuccess(); | ||
105 | |||
106 | Assert.True(File.Exists(msiPath)); | ||
107 | var results = Query.QueryDatabase(msiPath, new[] { "CustomTableWithFile" }); | ||
108 | Assert.Equal(new[] | ||
109 | { | ||
110 | "CustomTableWithFile:Row1\t[Binary data]", | ||
111 | "CustomTableWithFile:Row2\t[Binary data]", | ||
112 | }, results); | ||
113 | } | ||
114 | } | ||
115 | |||
116 | [Fact] | ||
117 | public void PopulatesCustomTableWithFilePathSerialized() | ||
118 | { | ||
119 | var folder = TestData.Get(@"TestData"); | ||
120 | |||
121 | using (var fs = new DisposableFileSystem()) | ||
122 | { | ||
123 | var baseFolder = fs.GetFolder(); | ||
124 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
125 | var wixlibPath = Path.Combine(baseFolder, @"bin\test.wixlib"); | ||
126 | var msiPath = Path.Combine(baseFolder, @"bin\test.msi"); | ||
127 | |||
128 | var result = WixRunner.Execute(new[] | ||
129 | { | ||
130 | "build", | ||
131 | Path.Combine(folder, "CustomTable", "CustomTableWithFile.wxs"), | ||
132 | "-bindpath", Path.Combine(folder, "CustomTable", "data"), | ||
133 | "-intermediateFolder", intermediateFolder, | ||
134 | "-o", wixlibPath | ||
135 | }); | ||
136 | |||
137 | result.AssertSuccess(); | ||
138 | |||
139 | result = WixRunner.Execute(new[] | ||
140 | { | ||
141 | "build", | ||
142 | Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), | ||
143 | Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), | ||
144 | "-lib", wixlibPath, | ||
145 | "-bindpath", Path.Combine(folder, "CustomTable", "data"), | ||
146 | "-intermediateFolder", intermediateFolder, | ||
147 | "-o", msiPath | ||
148 | }); | ||
149 | |||
150 | result.AssertSuccess(); | ||
151 | |||
152 | Assert.True(File.Exists(msiPath)); | ||
153 | var results = Query.QueryDatabase(msiPath, new[] { "CustomTableWithFile" }); | ||
154 | Assert.Equal(new[] | ||
155 | { | ||
156 | "CustomTableWithFile:Row1\t[Binary data]", | ||
157 | "CustomTableWithFile:Row2\t[Binary data]", | ||
158 | }, results); | ||
159 | } | ||
160 | } | ||
161 | |||
162 | [Fact] | ||
163 | public void UnrealCustomTableIsNotPresentInMsi() | ||
164 | { | ||
165 | var folder = TestData.Get(@"TestData"); | ||
166 | |||
167 | using (var fs = new DisposableFileSystem()) | ||
168 | { | ||
169 | var baseFolder = fs.GetFolder(); | ||
170 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
171 | var msiPath = Path.Combine(baseFolder, @"bin\test.msi"); | ||
172 | |||
173 | var result = WixRunner.Execute(new[] | ||
174 | { | ||
175 | "build", | ||
176 | Path.Combine(folder, "CustomTable", "CustomTable.wxs"), | ||
177 | Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), | ||
178 | Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), | ||
179 | "-bindpath", Path.Combine(folder, "SingleFile", "data"), | ||
180 | "-intermediateFolder", intermediateFolder, | ||
181 | "-o", msiPath | ||
182 | }); | ||
183 | |||
184 | result.AssertSuccess(); | ||
185 | |||
186 | Assert.True(File.Exists(msiPath)); | ||
187 | var results = Query.QueryDatabase(msiPath, new[] { "CustomTable2" }); | ||
188 | Assert.Empty(results); | ||
189 | } | ||
190 | } | ||
191 | |||
192 | [Fact] | ||
193 | public void CanCompileAndDecompile() | ||
194 | { | ||
195 | var folder = TestData.Get(@"TestData"); | ||
196 | var expectedFile = Path.Combine(folder, "CustomTable", "CustomTable-Expected.wxs"); | ||
197 | |||
198 | using (var fs = new DisposableFileSystem()) | ||
199 | { | ||
200 | var baseFolder = fs.GetFolder(); | ||
201 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
202 | var msiPath = Path.Combine(baseFolder, @"bin\test.msi"); | ||
203 | var decompiledWxsPath = Path.Combine(baseFolder, @"decompiled.wxs"); | ||
204 | |||
205 | var result = WixRunner.Execute(new[] | ||
206 | { | ||
207 | "build", | ||
208 | "-d", "ProductCode=83f9c623-26fe-42ab-951e-170022117f54", | ||
209 | Path.Combine(folder, "CustomTable", "CustomTable.wxs"), | ||
210 | Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), | ||
211 | Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), | ||
212 | "-bindpath", Path.Combine(folder, "SingleFile", "data"), | ||
213 | "-intermediateFolder", intermediateFolder, | ||
214 | "-o", msiPath | ||
215 | }); | ||
216 | |||
217 | result.AssertSuccess(); | ||
218 | Assert.True(File.Exists(msiPath)); | ||
219 | |||
220 | result = WixRunner.Execute(new[] | ||
221 | { | ||
222 | "decompile", msiPath, | ||
223 | "-sw1060", | ||
224 | "-intermediateFolder", intermediateFolder, | ||
225 | "-o", decompiledWxsPath | ||
226 | }); | ||
227 | |||
228 | result.AssertSuccess(); | ||
229 | |||
230 | WixAssert.CompareXml(expectedFile, decompiledWxsPath); | ||
231 | } | ||
232 | } | ||
233 | } | ||
234 | } | ||