diff options
Diffstat (limited to 'src/WixToolsetTest.BurnE2E/BundleVerifier.cs')
-rw-r--r-- | src/WixToolsetTest.BurnE2E/BundleVerifier.cs | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/src/WixToolsetTest.BurnE2E/BundleVerifier.cs b/src/WixToolsetTest.BurnE2E/BundleVerifier.cs index 94d51890..98ec96a0 100644 --- a/src/WixToolsetTest.BurnE2E/BundleVerifier.cs +++ b/src/WixToolsetTest.BurnE2E/BundleVerifier.cs | |||
@@ -33,14 +33,19 @@ namespace WixToolsetTest.BurnE2E | |||
33 | return this.BundleSymbol; | 33 | return this.BundleSymbol; |
34 | } | 34 | } |
35 | 35 | ||
36 | public string GetExpectedCachedBundlePath() | 36 | public string GetPackageCachePathForCacheId(string cacheId) |
37 | { | 37 | { |
38 | var bundleSymbol = this.GetBundleSymbol(); | ||
39 | |||
40 | using var policyKey = Registry.LocalMachine.OpenSubKey(FULL_BURN_POLICY_REGISTRY_PATH); | 38 | using var policyKey = Registry.LocalMachine.OpenSubKey(FULL_BURN_POLICY_REGISTRY_PATH); |
41 | var redirectedCachePath = policyKey?.GetValue("PackageCache") as string; | 39 | var redirectedCachePath = policyKey?.GetValue("PackageCache") as string; |
42 | var cachePath = redirectedCachePath ?? Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), PACKAGE_CACHE_FOLDER_NAME); | 40 | var cachePath = redirectedCachePath ?? Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), PACKAGE_CACHE_FOLDER_NAME); |
43 | return Path.Combine(cachePath, bundleSymbol.BundleId, Path.GetFileName(this.Bundle)); | 41 | return Path.Combine(cachePath, cacheId); |
42 | } | ||
43 | |||
44 | public string GetExpectedCachedBundlePath() | ||
45 | { | ||
46 | var bundleSymbol = this.GetBundleSymbol(); | ||
47 | var cachePath = this.GetPackageCachePathForCacheId(bundleSymbol.BundleId); | ||
48 | return Path.Combine(cachePath, Path.GetFileName(this.Bundle)); | ||
44 | } | 49 | } |
45 | 50 | ||
46 | public bool TryGetPerMachineRegistration(out BundleRegistration registration) | 51 | public bool TryGetPerMachineRegistration(out BundleRegistration registration) |
@@ -74,5 +79,18 @@ namespace WixToolsetTest.BurnE2E | |||
74 | Assert.False(this.TryGetPerMachineRegistration(out _)); | 79 | Assert.False(this.TryGetPerMachineRegistration(out _)); |
75 | Assert.False(File.Exists(cachedBundlePath)); | 80 | Assert.False(File.Exists(cachedBundlePath)); |
76 | } | 81 | } |
82 | |||
83 | public void RemovePackageFromCache(string packageId) | ||
84 | { | ||
85 | using var wixOutput = WixOutput.Read(this.BundlePdb); | ||
86 | var intermediate = Intermediate.Load(wixOutput); | ||
87 | var section = intermediate.Sections.Single(); | ||
88 | var packageSymbol = section.Symbols.OfType<WixBundlePackageSymbol>().Single(p => p.Id.Id == packageId); | ||
89 | var cachePath = this.GetPackageCachePathForCacheId(packageSymbol.CacheId); | ||
90 | if (Directory.Exists(cachePath)) | ||
91 | { | ||
92 | Directory.Delete(cachePath, true); | ||
93 | } | ||
94 | } | ||
77 | } | 95 | } |
78 | } | 96 | } |