From 72d694ee9cb6954953e55bf05b09c93ddebdc9d3 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Tue, 30 Mar 2021 15:50:32 -0500 Subject: Add layout tests. --- src/WixTestTools/BundleInstaller.cs | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'src/WixTestTools') diff --git a/src/WixTestTools/BundleInstaller.cs b/src/WixTestTools/BundleInstaller.cs index 859656ad..34661651 100644 --- a/src/WixTestTools/BundleInstaller.cs +++ b/src/WixTestTools/BundleInstaller.cs @@ -48,6 +48,31 @@ namespace WixTestTools return this.RunBundleWithArguments(expectedExitCode, MSIExec.MSIExecMode.Install, arguments, bundlePath: bundlePath); } + /// + /// Calls Layout for the bundle with optional arguments. + /// + /// The destination directory. + /// Expected exit code, defaults to success. + /// Optional arguments to pass to the tool. + /// Path to the generated log file. + public string Layout(string layoutDirectory, int expectedExitCode = (int)MSIExec.MSIExecReturnCode.SUCCESS, params string[] arguments) + { + return this.RunBundleWithArguments(expectedExitCode, MSIExec.MSIExecMode.AdministrativeInstall, arguments, layoutDirectory: layoutDirectory); + } + + /// + /// Calls Layout for the bundle with optional arguments. + /// + /// Path to the bundle to run. + /// The destination directory. + /// Expected exit code, defaults to success. + /// Optional arguments to pass to the tool. + /// Path to the generated log file. + public string Layout(string bundlePath, string layoutDirectory, int expectedExitCode = (int)MSIExec.MSIExecReturnCode.SUCCESS, params string[] arguments) + { + return this.RunBundleWithArguments(expectedExitCode, MSIExec.MSIExecMode.AdministrativeInstall, arguments, bundlePath: bundlePath, layoutDirectory: layoutDirectory); + } + /// /// Modify the bundle with optional arguments. /// @@ -100,7 +125,7 @@ namespace WixTestTools /// Install mode. /// Optional arguments to pass to the tool. /// Path to the generated log file. - private string RunBundleWithArguments(int expectedExitCode, MSIExec.MSIExecMode mode, string[] arguments, bool assertOnError = true, string bundlePath = null) + private string RunBundleWithArguments(int expectedExitCode, MSIExec.MSIExecMode mode, string[] arguments, bool assertOnError = true, string bundlePath = null, string layoutDirectory = null) { TestTool bundle = new TestTool(bundlePath ?? this.Bundle); var sb = new StringBuilder(); @@ -115,6 +140,10 @@ namespace WixTestTools // Set operation. switch (mode) { + case MSIExec.MSIExecMode.AdministrativeInstall: + sb.Append($" -layout \"{layoutDirectory}\""); + break; + case MSIExec.MSIExecMode.Modify: sb.Append(" -modify"); break; -- cgit v1.2.3-55-g6feb