From 7cc4271c9d78ed60e354f585d03b612a9efb7cf3 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Thu, 11 Mar 2021 20:57:52 -0600 Subject: Add tests to verify #4991 and #5702. --- src/WixTestTools/BundleInstaller.cs | 12 ++++++++++++ src/WixTestTools/BundleVerifier.cs | 14 ++++++++++++++ src/WixTestTools/WixTestTools.csproj | 4 ++-- 3 files changed, 28 insertions(+), 2 deletions(-) (limited to 'src/WixTestTools') diff --git a/src/WixTestTools/BundleInstaller.cs b/src/WixTestTools/BundleInstaller.cs index 854c12f0..859656ad 100644 --- a/src/WixTestTools/BundleInstaller.cs +++ b/src/WixTestTools/BundleInstaller.cs @@ -36,6 +36,18 @@ namespace WixTestTools return this.RunBundleWithArguments(expectedExitCode, MSIExec.MSIExecMode.Install, arguments); } + /// + /// Installs the bundle with optional arguments. + /// + /// This should be the bundle in the package cache. + /// Expected exit code, defaults to success. + /// Optional arguments to pass to the tool. + /// Path to the generated log file. + public string Install(string bundlePath, int expectedExitCode = (int)MSIExec.MSIExecReturnCode.SUCCESS, params string[] arguments) + { + return this.RunBundleWithArguments(expectedExitCode, MSIExec.MSIExecMode.Install, arguments, bundlePath: bundlePath); + } + /// /// Modify the bundle with optional arguments. /// diff --git a/src/WixTestTools/BundleVerifier.cs b/src/WixTestTools/BundleVerifier.cs index 433b6a0a..293da560 100644 --- a/src/WixTestTools/BundleVerifier.cs +++ b/src/WixTestTools/BundleVerifier.cs @@ -56,6 +56,20 @@ namespace WixTestTools return Path.Combine(cachePath, Path.GetFileName(this.Bundle)); } + public string ManuallyCache() + { + var expectedCachePath = this.GetExpectedCachedBundlePath(); + Directory.CreateDirectory(Path.GetDirectoryName(expectedCachePath)); + File.Copy(this.Bundle, expectedCachePath); + return expectedCachePath; + } + + public void ManuallyUncache() + { + var expectedCachePath = this.GetExpectedCachedBundlePath(); + File.Delete(expectedCachePath); + } + public bool TryGetRegistration(out BundleRegistration registration) { var bundleSymbol = this.GetBundleSymbol(); diff --git a/src/WixTestTools/WixTestTools.csproj b/src/WixTestTools/WixTestTools.csproj index 0c3c4c76..38b2cb35 100644 --- a/src/WixTestTools/WixTestTools.csproj +++ b/src/WixTestTools/WixTestTools.csproj @@ -11,8 +11,8 @@ - - + + -- cgit v1.2.3-55-g6feb