diff options
Diffstat (limited to 'src/test/WixToolsetTest.BuildTasks/MsbuildFixture.cs')
-rw-r--r-- | src/test/WixToolsetTest.BuildTasks/MsbuildFixture.cs | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/src/test/WixToolsetTest.BuildTasks/MsbuildFixture.cs b/src/test/WixToolsetTest.BuildTasks/MsbuildFixture.cs new file mode 100644 index 00000000..79975f37 --- /dev/null +++ b/src/test/WixToolsetTest.BuildTasks/MsbuildFixture.cs | |||
@@ -0,0 +1,62 @@ | |||
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.BuildTasks | ||
4 | { | ||
5 | using System.IO; | ||
6 | using System.Linq; | ||
7 | using Microsoft.Build.Utilities; | ||
8 | using WixBuildTools.TestSupport; | ||
9 | using WixToolset.BuildTasks; | ||
10 | using WixToolset.Data; | ||
11 | using WixToolset.Data.Tuples; | ||
12 | using Xunit; | ||
13 | |||
14 | public partial class MsbuildFixture | ||
15 | { | ||
16 | [Fact] | ||
17 | public void CanBuildSingleFile() | ||
18 | { | ||
19 | var folder = TestData.Get(@"TestData\SimpleMsiPackage\MsiPackage"); | ||
20 | |||
21 | using (var fs = new DisposableFileSystem()) | ||
22 | { | ||
23 | var baseFolder = fs.GetFolder(); | ||
24 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
25 | |||
26 | var task = new DoIt | ||
27 | { | ||
28 | BuildEngine = new FakeBuildEngine(), | ||
29 | SourceFiles = new[] | ||
30 | { | ||
31 | new TaskItem(Path.Combine(folder, "Package.wxs")), | ||
32 | new TaskItem(Path.Combine(folder, "PackageComponents.wxs")), | ||
33 | }, | ||
34 | LocalizationFiles = new[] | ||
35 | { | ||
36 | new TaskItem(Path.Combine(folder, "Package.en-us.wxl")), | ||
37 | }, | ||
38 | BindInputPaths = new[] | ||
39 | { | ||
40 | new TaskItem(Path.Combine(folder, "data")), | ||
41 | }, | ||
42 | IntermediateDirectory = new TaskItem(intermediateFolder), | ||
43 | OutputFile = new TaskItem(Path.Combine(baseFolder, @"bin\test.msi")), | ||
44 | }; | ||
45 | |||
46 | var result = task.Execute(); | ||
47 | Assert.True(result, "MSBuild task failed unexpectedly."); | ||
48 | |||
49 | Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.msi"))); | ||
50 | Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.wixpdb"))); | ||
51 | Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\cab1.cab"))); | ||
52 | |||
53 | var intermediate = Intermediate.Load(Path.Combine(baseFolder, @"bin\test.wir")); | ||
54 | var section = intermediate.Sections.Single(); | ||
55 | |||
56 | var wixFile = section.Tuples.OfType<WixFileTuple>().Single(); | ||
57 | Assert.Equal(Path.Combine(folder, @"data\test.txt"), wixFile[WixFileTupleFields.Source].AsPath().Path); | ||
58 | Assert.Equal(@"test.txt", wixFile[WixFileTupleFields.Source].PreviousValue.AsPath().Path); | ||
59 | } | ||
60 | } | ||
61 | } | ||
62 | } | ||