From f4329d17538c14569ab7058c1c378aa5b2297b2c Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Sun, 15 Jan 2023 20:29:17 -0600 Subject: Implement SourceDir substitution for Payloads. 7160 --- .../DirectoryToPayloadGroupFixture.cs | 80 ++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 src/tools/test/WixToolsetTest.Heat/DirectoryToPayloadGroupFixture.cs (limited to 'src/tools/test/WixToolsetTest.Heat/DirectoryToPayloadGroupFixture.cs') 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 @@ +// 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. + +namespace WixToolsetTest.Heat +{ + using System; + using System.IO; + using System.Linq; + using WixInternal.TestSupport; + using Xunit; + + public class DirectoryToPayloadGroupFixture + { + [Fact] + public void CanHarvestSimpleDirectory() + { + var folder = TestData.Get("TestData", "SingleFile"); + + using (var fs = new DisposableFileSystem()) + { + var outputPath = Path.Combine(fs.GetFolder(), "out.wxs"); + + var args = new[] + { + "dir", folder, + "-generate", "payloadgroup", + "-o", outputPath + }; + + var result = HeatRunner.Execute(args); + result.AssertSuccess(); + + var wxs = File.ReadAllLines(outputPath).Select(s => s.Replace("\"", "'")).ToArray(); + WixAssert.CompareLineByLine(new[] + { + "", + " ", + " ", + " ", + " ", + " ", + "", + }, wxs); + } + } + + [Fact] + public void CanHarvestSimpleDirectoryWithSourceDirSubstitution() + { + var folder = TestData.Get("TestData", "SingleFile"); + + using (var fs = new DisposableFileSystem()) + { + var outputPath = Path.Combine(fs.GetFolder(), "out.wxs"); + + var args = new[] + { + "dir", folder, + "-generate", "payloadgroup", + "-var", "var.RootDir", + "-o", outputPath + }; + + var result = HeatRunner.Execute(args); + result.AssertSuccess(); + + var wxs = File.ReadAllLines(outputPath).Select(s => s.Replace("\"", "'")).ToArray(); + WixAssert.CompareLineByLine(new[] + { + "", + " ", + " ", + " ", + " ", + " ", + "", + }, wxs); + } + } + } +} -- cgit v1.2.3-55-g6feb