aboutsummaryrefslogtreecommitdiff
path: root/src/WixTestTools/BundleInstaller.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/WixTestTools/BundleInstaller.cs')
-rw-r--r--src/WixTestTools/BundleInstaller.cs31
1 files changed, 30 insertions, 1 deletions
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
@@ -49,6 +49,31 @@ namespace WixTestTools
49 } 49 }
50 50
51 /// <summary> 51 /// <summary>
52 /// Calls Layout for the bundle with optional arguments.
53 /// </summary>
54 /// <param name="layoutDirectory">The destination directory.</param>
55 /// <param name="expectedExitCode">Expected exit code, defaults to success.</param>
56 /// <param name="arguments">Optional arguments to pass to the tool.</param>
57 /// <returns>Path to the generated log file.</returns>
58 public string Layout(string layoutDirectory, int expectedExitCode = (int)MSIExec.MSIExecReturnCode.SUCCESS, params string[] arguments)
59 {
60 return this.RunBundleWithArguments(expectedExitCode, MSIExec.MSIExecMode.AdministrativeInstall, arguments, layoutDirectory: layoutDirectory);
61 }
62
63 /// <summary>
64 /// Calls Layout for the bundle with optional arguments.
65 /// </summary>
66 /// <param name="bundlePath">Path to the bundle to run.</param>
67 /// <param name="layoutDirectory">The destination directory.</param>
68 /// <param name="expectedExitCode">Expected exit code, defaults to success.</param>
69 /// <param name="arguments">Optional arguments to pass to the tool.</param>
70 /// <returns>Path to the generated log file.</returns>
71 public string Layout(string bundlePath, string layoutDirectory, int expectedExitCode = (int)MSIExec.MSIExecReturnCode.SUCCESS, params string[] arguments)
72 {
73 return this.RunBundleWithArguments(expectedExitCode, MSIExec.MSIExecMode.AdministrativeInstall, arguments, bundlePath: bundlePath, layoutDirectory: layoutDirectory);
74 }
75
76 /// <summary>
52 /// Modify the bundle with optional arguments. 77 /// Modify the bundle with optional arguments.
53 /// </summary> 78 /// </summary>
54 /// <param name="expectedExitCode">Expected exit code, defaults to success.</param> 79 /// <param name="expectedExitCode">Expected exit code, defaults to success.</param>
@@ -100,7 +125,7 @@ namespace WixTestTools
100 /// <param name="mode">Install mode.</param> 125 /// <param name="mode">Install mode.</param>
101 /// <param name="arguments">Optional arguments to pass to the tool.</param> 126 /// <param name="arguments">Optional arguments to pass to the tool.</param>
102 /// <returns>Path to the generated log file.</returns> 127 /// <returns>Path to the generated log file.</returns>
103 private string RunBundleWithArguments(int expectedExitCode, MSIExec.MSIExecMode mode, string[] arguments, bool assertOnError = true, string bundlePath = null) 128 private string RunBundleWithArguments(int expectedExitCode, MSIExec.MSIExecMode mode, string[] arguments, bool assertOnError = true, string bundlePath = null, string layoutDirectory = null)
104 { 129 {
105 TestTool bundle = new TestTool(bundlePath ?? this.Bundle); 130 TestTool bundle = new TestTool(bundlePath ?? this.Bundle);
106 var sb = new StringBuilder(); 131 var sb = new StringBuilder();
@@ -115,6 +140,10 @@ namespace WixTestTools
115 // Set operation. 140 // Set operation.
116 switch (mode) 141 switch (mode)
117 { 142 {
143 case MSIExec.MSIExecMode.AdministrativeInstall:
144 sb.Append($" -layout \"{layoutDirectory}\"");
145 break;
146
118 case MSIExec.MSIExecMode.Modify: 147 case MSIExec.MSIExecMode.Modify:
119 sb.Append(" -modify"); 148 sb.Append(" -modify");
120 break; 149 break;