diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2023-01-15 20:29:17 -0600 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2023-01-15 22:03:31 -0600 |
commit | f4329d17538c14569ab7058c1c378aa5b2297b2c (patch) | |
tree | cfd3621d068f082d254dd6f6b2ce08f85ca85971 /src/tools/test/WixToolsetTest.Heat | |
parent | fb8903d9a185a020d54d2bb001f4331caf7c3825 (diff) | |
download | wix-f4329d17538c14569ab7058c1c378aa5b2297b2c.tar.gz wix-f4329d17538c14569ab7058c1c378aa5b2297b2c.tar.bz2 wix-f4329d17538c14569ab7058c1c378aa5b2297b2c.zip |
Implement SourceDir substitution for Payloads.
7160
Diffstat (limited to 'src/tools/test/WixToolsetTest.Heat')
-rw-r--r-- | src/tools/test/WixToolsetTest.Heat/DirectoryToPayloadGroupFixture.cs | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/src/tools/test/WixToolsetTest.Heat/DirectoryToPayloadGroupFixture.cs b/src/tools/test/WixToolsetTest.Heat/DirectoryToPayloadGroupFixture.cs new file mode 100644 index 00000000..c9b8ee30 --- /dev/null +++ b/src/tools/test/WixToolsetTest.Heat/DirectoryToPayloadGroupFixture.cs | |||
@@ -0,0 +1,80 @@ | |||
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.Heat | ||
4 | { | ||
5 | using System; | ||
6 | using System.IO; | ||
7 | using System.Linq; | ||
8 | using WixInternal.TestSupport; | ||
9 | using Xunit; | ||
10 | |||
11 | public class DirectoryToPayloadGroupFixture | ||
12 | { | ||
13 | [Fact] | ||
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 | "-generate", "payloadgroup", | ||
26 | "-o", outputPath | ||
27 | }; | ||
28 | |||
29 | var result = HeatRunner.Execute(args); | ||
30 | result.AssertSuccess(); | ||
31 | |||
32 | var wxs = File.ReadAllLines(outputPath).Select(s => s.Replace("\"", "'")).ToArray(); | ||
33 | WixAssert.CompareLineByLine(new[] | ||
34 | { | ||
35 | "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>", | ||
36 | " <Fragment>", | ||
37 | " <PayloadGroup Id='TARGETDIR'>", | ||
38 | " <Payload SourceFile='SourceDir\\a.txt' />", | ||
39 | " </PayloadGroup>", | ||
40 | " </Fragment>", | ||
41 | "</Wix>", | ||
42 | }, wxs); | ||
43 | } | ||
44 | } | ||
45 | |||
46 | [Fact] | ||
47 | public void CanHarvestSimpleDirectoryWithSourceDirSubstitution() | ||
48 | { | ||
49 | var folder = TestData.Get("TestData", "SingleFile"); | ||
50 | |||
51 | using (var fs = new DisposableFileSystem()) | ||
52 | { | ||
53 | var outputPath = Path.Combine(fs.GetFolder(), "out.wxs"); | ||
54 | |||
55 | var args = new[] | ||
56 | { | ||
57 | "dir", folder, | ||
58 | "-generate", "payloadgroup", | ||
59 | "-var", "var.RootDir", | ||
60 | "-o", outputPath | ||
61 | }; | ||
62 | |||
63 | var result = HeatRunner.Execute(args); | ||
64 | result.AssertSuccess(); | ||
65 | |||
66 | var wxs = File.ReadAllLines(outputPath).Select(s => s.Replace("\"", "'")).ToArray(); | ||
67 | WixAssert.CompareLineByLine(new[] | ||
68 | { | ||
69 | "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>", | ||
70 | " <Fragment>", | ||
71 | " <PayloadGroup Id='TARGETDIR'>", | ||
72 | " <Payload SourceFile='$(var.RootDir)\\a.txt' />", | ||
73 | " </PayloadGroup>", | ||
74 | " </Fragment>", | ||
75 | "</Wix>", | ||
76 | }, wxs); | ||
77 | } | ||
78 | } | ||
79 | } | ||
80 | } | ||