Example #1
0
        public void Burn_RetryThenCancel()
        {
            this.SetPackageRetryExecuteFilesInUse("PackageA", 1);

            string bundleAPath = this.GetBundleA().Output;
            BundleInstaller installA = new BundleInstaller(this, bundleAPath);

            // Lock the file that will be installed.
            string targetInstallFile = this.GetTestInstallFolder("A\\A.wxs");
            Directory.CreateDirectory(Path.GetDirectoryName(targetInstallFile));
            using (FileStream lockTargetFile = new FileStream(targetInstallFile, FileMode.Create, FileAccess.Write, FileShare.Read))
            {
                installA.Install(expectedExitCode:(int)MSIExec.MSIExecReturnCode.ERROR_INSTALL_USEREXIT);
            }

            this.Complete();
        }
Example #2
0
        public void Burn_RetryThenCancel()
        {
            this.SetPackageRetryExecuteFilesInUse("PackageA", 1);

            string          bundleAPath = this.GetBundleA().Output;
            BundleInstaller installA    = new BundleInstaller(this, bundleAPath);

            // Lock the file that will be installed.
            string targetInstallFile = this.GetTestInstallFolder("A\\A.wxs");

            Directory.CreateDirectory(Path.GetDirectoryName(targetInstallFile));
            using (FileStream lockTargetFile = new FileStream(targetInstallFile, FileMode.Create, FileAccess.Write, FileShare.Read))
            {
                installA.Install(expectedExitCode: (int)MSIExec.MSIExecReturnCode.ERROR_INSTALL_USEREXIT);
            }

            this.Complete();
        }
        public void Burn_ForwardCompatiblePerUserParentTwiceMajorUpgrade()
        {
            string providerId    = String.Concat("~", this.TestContext.TestName, "_BundleC");
            string parent        = "~BundleCv1";
            string parent2       = "~BundleCv1_Parent2";
            string parentSwitch  = String.Concat("-parent ", parent);
            string parent2Switch = String.Concat("-parent ", parent2);

            // Build.
            string packageC   = this.GetPackageC().Output;
            string packageCv2 = this.GetPackageCv2().Output;

            string bundleC   = this.GetBundleC().Output;
            string bundleCv2 = this.GetBundleCv2().Output;

            // Install the v1 bundle with a parent.
            BundleInstaller installerCv1 = new BundleInstaller(this, bundleC).Install(arguments: parentSwitch);

            Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageC));
            Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageCv2));

            string actualProviderVersion;

            Assert.IsTrue(this.TryGetDependencyProviderValue(providerId, "Version", out actualProviderVersion));
            Assert.AreEqual("1.0.0.0", actualProviderVersion);
            Assert.IsTrue(this.DependencyDependentExists(providerId, parent));

            // Install the v1 bundle with a second parent.
            installerCv1.Install(arguments: parent2Switch);
            Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageC));
            Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageCv2));

            Assert.IsTrue(this.TryGetDependencyProviderValue(providerId, "Version", out actualProviderVersion));
            Assert.AreEqual("1.0.0.0", actualProviderVersion);
            Assert.IsTrue(this.DependencyDependentExists(providerId, parent));

            // Upgrade with the v2 bundle.
            BundleInstaller installerCv2 = new BundleInstaller(this, bundleCv2).Install();

            Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageC));
            Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageCv2));

            Assert.IsTrue(this.TryGetDependencyProviderValue(providerId, "Version", out actualProviderVersion));
            Assert.AreEqual(V2, actualProviderVersion);
            Assert.IsTrue(this.DependencyDependentExists(providerId, parent));

            // Uninstall the v2 bundle and nothing should happen because there is still a parent.
            installerCv2.Uninstall();
            Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageC));
            Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageCv2));

            Assert.IsTrue(this.TryGetDependencyProviderValue(providerId, "Version", out actualProviderVersion));
            Assert.AreEqual(V2, actualProviderVersion);
            Assert.IsTrue(this.DependencyDependentExists(providerId, parent));

            // Uninstall one parent of the v1 bundle and nothing should happen because there is still a parent.
            installerCv1.Uninstall(arguments: parentSwitch);
            Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageC));
            Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageCv2));

            Assert.IsTrue(this.TryGetDependencyProviderValue(providerId, "Version", out actualProviderVersion));
            Assert.AreEqual(V2, actualProviderVersion);
            Assert.IsTrue(this.DependencyDependentExists(providerId, parent2));

            // Uninstall the v1 bundle with passthrough with second parent and all should be removed.
            installerCv1.Uninstall(arguments: parent2Switch);
            Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageC));
            Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageCv2));

            Assert.IsFalse(this.TryGetDependencyProviderValue(providerId, "Version", out actualProviderVersion));

            this.CleanTestArtifacts = true;
        }
        public void Burn_ForwardCompatiblePerUserParentTwiceMajorUpgrade()
        {
            string providerId = String.Concat("~", this.TestContext.TestName, "_BundleC");
            string parent = "~BundleCv1";
            string parent2 = "~BundleCv1_Parent2";
            string parentSwitch = String.Concat("-parent ", parent);
            string parent2Switch = String.Concat("-parent ", parent2);

            // Build.
            string packageC = this.GetPackageC().Output;
            string packageCv2 = this.GetPackageCv2().Output;

            string bundleC = this.GetBundleC().Output;
            string bundleCv2 = this.GetBundleCv2().Output;

            // Install the v1 bundle with a parent.
            BundleInstaller installerCv1 = new BundleInstaller(this, bundleC).Install(arguments: parentSwitch);
            Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageC));
            Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageCv2));

            string actualProviderVersion;
            Assert.IsTrue(this.TryGetDependencyProviderValue(providerId, "Version", out actualProviderVersion));
            Assert.AreEqual("1.0.0.0", actualProviderVersion);
            Assert.IsTrue(this.DependencyDependentExists(providerId, parent));

            // Install the v1 bundle with a second parent.
            installerCv1.Install(arguments: parent2Switch);
            Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageC));
            Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageCv2));

            Assert.IsTrue(this.TryGetDependencyProviderValue(providerId, "Version", out actualProviderVersion));
            Assert.AreEqual("1.0.0.0", actualProviderVersion);
            Assert.IsTrue(this.DependencyDependentExists(providerId, parent));

            // Upgrade with the v2 bundle.
            BundleInstaller installerCv2 = new BundleInstaller(this, bundleCv2).Install();
            Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageC));
            Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageCv2));

            Assert.IsTrue(this.TryGetDependencyProviderValue(providerId, "Version", out actualProviderVersion));
            Assert.AreEqual(V2, actualProviderVersion);
            Assert.IsTrue(this.DependencyDependentExists(providerId, parent));

            // Uninstall the v2 bundle and nothing should happen because there is still a parent.
            installerCv2.Uninstall();
            Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageC));
            Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageCv2));

            Assert.IsTrue(this.TryGetDependencyProviderValue(providerId, "Version", out actualProviderVersion));
            Assert.AreEqual(V2, actualProviderVersion);
            Assert.IsTrue(this.DependencyDependentExists(providerId, parent));

            // Uninstall one parent of the v1 bundle and nothing should happen because there is still a parent.
            installerCv1.Uninstall(arguments: parentSwitch);
            Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageC));
            Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageCv2));

            Assert.IsTrue(this.TryGetDependencyProviderValue(providerId, "Version", out actualProviderVersion));
            Assert.AreEqual(V2, actualProviderVersion);
            Assert.IsTrue(this.DependencyDependentExists(providerId, parent2));

            // Uninstall the v1 bundle with passthrough with second parent and all should be removed.
            installerCv1.Uninstall(arguments: parent2Switch);
            Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageC));
            Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageCv2));

            Assert.IsFalse(this.TryGetDependencyProviderValue(providerId, "Version", out actualProviderVersion));

            this.CleanTestArtifacts = true;
        }