diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2021-03-30 15:50:32 -0500 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2021-03-30 16:05:00 -0500 |
commit | 72d694ee9cb6954953e55bf05b09c93ddebdc9d3 (patch) | |
tree | effa94ca53e95eed1eda71f18c38c564d6aca815 /src/WixTestTools | |
parent | 3221757bb210b23e4c8d859d20aa20b43c0df582 (diff) | |
download | wix-72d694ee9cb6954953e55bf05b09c93ddebdc9d3.tar.gz wix-72d694ee9cb6954953e55bf05b09c93ddebdc9d3.tar.bz2 wix-72d694ee9cb6954953e55bf05b09c93ddebdc9d3.zip |
Add layout tests.
Diffstat (limited to 'src/WixTestTools')
-rw-r--r-- | src/WixTestTools/BundleInstaller.cs | 31 |
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; |