From fb8903d9a185a020d54d2bb001f4331caf7c3825 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Sat, 14 Jan 2023 22:05:32 -0600 Subject: Improve test coverage for recent Burn changes. 7068, PR 318 --- src/test/burn/WixToolsetTest.BurnE2E/RegistrationTests.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/test') diff --git a/src/test/burn/WixToolsetTest.BurnE2E/RegistrationTests.cs b/src/test/burn/WixToolsetTest.BurnE2E/RegistrationTests.cs index d9eb36ba..65d0c9cd 100644 --- a/src/test/burn/WixToolsetTest.BurnE2E/RegistrationTests.cs +++ b/src/test/burn/WixToolsetTest.BurnE2E/RegistrationTests.cs @@ -15,6 +15,7 @@ namespace WixToolsetTest.BurnE2E [RuntimeFact] public void AllowsBAToKeepRegistration() { + const string fakeInstallDay = "20230101"; this.CreatePackageInstaller("PackageA"); var bundleA = this.CreateBundleInstaller("BundleA"); var testBAController = this.CreateTestBAController(); @@ -35,6 +36,12 @@ namespace WixToolsetTest.BurnE2E testBAController.SetForceKeepRegistration(null); testBAController.ResetPackageStates("PackageA"); + // Pretend the bundle was installed on this day to be able to verify that it is only written on the initial install. + using (var registrationKey = initialRegistration.BaseKey.OpenSubKey(initialRegistration.KeyPath, writable: true)) + { + registrationKey.SetValue(GenericArpRegistration.REGISTRY_ARP_INSTALL_DATE, fakeInstallDay); + } + bundleA.Install(); var finalRegistration = bundleA.VerifyRegisteredAndInPackageCache(); @@ -42,7 +49,7 @@ namespace WixToolsetTest.BurnE2E Assert.NotNull(finalRegistration.EstimatedSize); Assert.InRange(finalRegistration.EstimatedSize.Value, initialRegistration.EstimatedSize.Value + 1, Int32.MaxValue); - Assert.Equal(initialRegistration.InstallDate, finalRegistration.InstallDate); + Assert.Equal(fakeInstallDay, finalRegistration.InstallDate); } [RuntimeFact] -- cgit v1.2.3-55-g6feb