Improve test coverage for recent Burn changes.
7068, PR 318
Sean Hall committed
Jan 14, 2023 at 22:05 UTC
fb8903d9a185a020d54d2bb001f4331caf7c3825
2 files changed
+9
-2
src/burn/test/BurnUnitTest/CacheTest.cpp
+1
-1
@@ -83,7 +83,7 @@ namespace Bootstrapper
83
CacheUninitialize(&cache);
84
85
// Second fallback is system-level %TMP%.
86
- hr = RegWriteExpandString(hkSystemEnvironment, L"TMP", L"B:\\TEST\\TMP\\");
86
+ hr = RegWriteString(hkSystemEnvironment, L"TMP", L"B:\\TEST\\TMP\\");
87
NativeAssert::Succeeded(hr, "Failed to write TEMP system environment value.");
88
89
hr = CacheInitialize(&cache, &internalCommand);
src/test/burn/WixToolsetTest.BurnE2E/RegistrationTests.cs
+8
-1
@@ -15,6 +15,7 @@ namespace WixToolsetTest.BurnE2E
15
[RuntimeFact]
16
public void AllowsBAToKeepRegistration()
17
{
18
+ const string fakeInstallDay = "20230101";
19
this.CreatePackageInstaller("PackageA");
20
var bundleA = this.CreateBundleInstaller("BundleA");
21
var testBAController = this.CreateTestBAController();
@@ -35,6 +36,12 @@ namespace WixToolsetTest.BurnE2E
36
testBAController.SetForceKeepRegistration(null);
37
testBAController.ResetPackageStates("PackageA");
38
39
+ // Pretend the bundle was installed on this day to be able to verify that it is only written on the initial install.
40
+ using (var registrationKey = initialRegistration.BaseKey.OpenSubKey(initialRegistration.KeyPath, writable: true))
41
+ {
42
+ registrationKey.SetValue(GenericArpRegistration.REGISTRY_ARP_INSTALL_DATE, fakeInstallDay);
43
+ }
44
+
45
bundleA.Install();
46
var finalRegistration = bundleA.VerifyRegisteredAndInPackageCache();
47
@@ -42,7 +49,7 @@ namespace WixToolsetTest.BurnE2E
49
Assert.NotNull(finalRegistration.EstimatedSize);
50
Assert.InRange(finalRegistration.EstimatedSize.Value, initialRegistration.EstimatedSize.Value + 1, Int32.MaxValue);
51
45
- Assert.Equal(initialRegistration.InstallDate, finalRegistration.InstallDate);
52
+ Assert.Equal(fakeInstallDay, finalRegistration.InstallDate);
53
}
54
55
[RuntimeFact]