diff options
Diffstat (limited to 'src/test/WixToolsetTest.CoreIntegration/WixiplFixture.cs')
-rw-r--r-- | src/test/WixToolsetTest.CoreIntegration/WixiplFixture.cs | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/src/test/WixToolsetTest.CoreIntegration/WixiplFixture.cs b/src/test/WixToolsetTest.CoreIntegration/WixiplFixture.cs index df6542e2..60706948 100644 --- a/src/test/WixToolsetTest.CoreIntegration/WixiplFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/WixiplFixture.cs | |||
@@ -2,12 +2,14 @@ | |||
2 | 2 | ||
3 | namespace WixToolsetTest.CoreIntegration | 3 | namespace WixToolsetTest.CoreIntegration |
4 | { | 4 | { |
5 | using System; | ||
5 | using System.IO; | 6 | using System.IO; |
6 | using System.Linq; | 7 | using System.Linq; |
7 | using WixBuildTools.TestSupport; | 8 | using WixBuildTools.TestSupport; |
8 | using WixToolset.Core.TestPackage; | 9 | using WixToolset.Core.TestPackage; |
9 | using WixToolset.Data; | 10 | using WixToolset.Data; |
10 | using WixToolset.Data.Tuples; | 11 | using WixToolset.Data.Tuples; |
12 | using Example.Extension; | ||
11 | using Xunit; | 13 | using Xunit; |
12 | 14 | ||
13 | public class WixiplFixture | 15 | public class WixiplFixture |
@@ -88,5 +90,104 @@ namespace WixToolsetTest.CoreIntegration | |||
88 | Assert.Equal((int)ErrorMessages.Ids.WixiplSourceFileIsExclusive, result.ExitCode); | 90 | Assert.Equal((int)ErrorMessages.Ids.WixiplSourceFileIsExclusive, result.ExitCode); |
89 | } | 91 | } |
90 | } | 92 | } |
93 | |||
94 | [Fact] | ||
95 | public void CanBuildMsiUsingExtensionLibrary() | ||
96 | { | ||
97 | var folder = TestData.Get(@"TestData\Wixipl"); | ||
98 | var extensionPath = Path.GetFullPath(new Uri(typeof(ExampleExtensionFactory).Assembly.CodeBase).LocalPath); | ||
99 | |||
100 | using (var fs = new DisposableFileSystem()) | ||
101 | { | ||
102 | var baseFolder = fs.GetFolder(); | ||
103 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
104 | |||
105 | var result = WixRunner.Execute(new[] | ||
106 | { | ||
107 | "build", | ||
108 | "-ext", extensionPath, | ||
109 | Path.Combine(folder, "Package.wxs"), | ||
110 | Path.Combine(folder, "PackageComponents.wxs"), | ||
111 | "-loc", Path.Combine(folder, "Package.en-us.wxl"), | ||
112 | "-bindpath", Path.Combine(folder, "data"), | ||
113 | "-intermediateFolder", intermediateFolder, | ||
114 | "-o", Path.Combine(baseFolder, @"bin\test.msi"), | ||
115 | }); | ||
116 | |||
117 | result.AssertSuccess(); | ||
118 | |||
119 | var intermediate = Intermediate.Load(Path.Combine(baseFolder, @"obj\test.wir")); | ||
120 | var section = intermediate.Sections.Single(); | ||
121 | |||
122 | { | ||
123 | var wixFile = section.Tuples.OfType<WixFileTuple>().Single(); | ||
124 | Assert.Equal(Path.Combine(folder, @"data\test.txt"), wixFile[WixFileTupleFields.Source].AsPath().Path); | ||
125 | Assert.Equal(@"test.txt", wixFile[WixFileTupleFields.Source].PreviousValue.AsPath().Path); | ||
126 | } | ||
127 | |||
128 | { | ||
129 | var binary = section.Tuples.OfType<BinaryTuple>().Single(); | ||
130 | var path = binary[BinaryTupleFields.Data].AsPath().Path; | ||
131 | Assert.Contains("Example.Extension", path); | ||
132 | Assert.EndsWith(@"\0", path); | ||
133 | Assert.Equal(@"BinFromWir", binary[BinaryTupleFields.Name].AsString()); | ||
134 | } | ||
135 | } | ||
136 | } | ||
137 | |||
138 | [Fact] | ||
139 | public void CanBuildWixiplUsingExtensionLibrary() | ||
140 | { | ||
141 | var folder = TestData.Get(@"TestData\Wixipl"); | ||
142 | var extensionPath = Path.GetFullPath(new Uri(typeof(ExampleExtensionFactory).Assembly.CodeBase).LocalPath); | ||
143 | |||
144 | using (var fs = new DisposableFileSystem()) | ||
145 | { | ||
146 | var baseFolder = fs.GetFolder(); | ||
147 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
148 | |||
149 | var result = WixRunner.Execute(new[] | ||
150 | { | ||
151 | "build", | ||
152 | "-ext", extensionPath, | ||
153 | Path.Combine(folder, "Package.wxs"), | ||
154 | Path.Combine(folder, "PackageComponents.wxs"), | ||
155 | "-intermediateFolder", intermediateFolder, | ||
156 | "-o", Path.Combine(intermediateFolder, @"test.wixipl"), | ||
157 | }); | ||
158 | |||
159 | result.AssertSuccess(); | ||
160 | |||
161 | result = WixRunner.Execute(new[] | ||
162 | { | ||
163 | "build", | ||
164 | Path.Combine(intermediateFolder, @"test.wixipl"), | ||
165 | "-ext", extensionPath, | ||
166 | "-loc", Path.Combine(folder, "Package.en-us.wxl"), | ||
167 | "-bindpath", Path.Combine(folder, "data"), | ||
168 | "-intermediateFolder", intermediateFolder, | ||
169 | "-o", Path.Combine(baseFolder, @"bin\test.msi"), | ||
170 | }); | ||
171 | |||
172 | result.AssertSuccess(); | ||
173 | |||
174 | var intermediate = Intermediate.Load(Path.Combine(baseFolder, @"obj\test.wir")); | ||
175 | var section = intermediate.Sections.Single(); | ||
176 | |||
177 | { | ||
178 | var wixFile = section.Tuples.OfType<WixFileTuple>().Single(); | ||
179 | Assert.Equal(Path.Combine(folder, @"data\test.txt"), wixFile[WixFileTupleFields.Source].AsPath().Path); | ||
180 | Assert.Equal(@"test.txt", wixFile[WixFileTupleFields.Source].PreviousValue.AsPath().Path); | ||
181 | } | ||
182 | |||
183 | { | ||
184 | var binary = section.Tuples.OfType<BinaryTuple>().Single(); | ||
185 | var path = binary[BinaryTupleFields.Data].AsPath().Path; | ||
186 | Assert.Contains("Example.Extension", path); | ||
187 | Assert.EndsWith(@"\0", path); | ||
188 | Assert.Equal(@"BinFromWir", binary[BinaryTupleFields.Name].AsString()); | ||
189 | } | ||
190 | } | ||
191 | } | ||
91 | } | 192 | } |
92 | } | 193 | } |