aboutsummaryrefslogtreecommitdiff
path: root/src/test/burn/WixToolsetTest.BurnE2E/BundlePackageTests.cs
blob: 1e6cda9c713f2c6a41d10f204dc438c12572a855 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.

namespace WixToolsetTest.BurnE2E
{
    using System.IO;
    using Xunit;
    using Xunit.Abstractions;

    public class BundlePackageTests : BurnE2ETests
    {
        public BundlePackageTests(ITestOutputHelper testOutputHelper) : base(testOutputHelper) { }

        [Fact]
        public void CanInstallAndUninstallBundlePackages()
        {
            var packageA = this.CreatePackageInstaller(@"..\BasicFunctionalityTests\PackageA");
            var packageA_x64 = this.CreatePackageInstaller(@"..\BasicFunctionalityTests\PackageA_x64");
            var bundleA = this.CreateBundleInstaller(@"..\BasicFunctionalityTests\BundleA");
            var bundleB_x64 = this.CreateBundleInstaller(@"..\BasicFunctionalityTests\BundleB_x64");
            var multipleBundlePackagesBundle = this.CreateBundleInstaller(@"MultipleBundlePackagesBundle");

            var packageA32SourceCodeFilePath = packageA.GetInstalledFilePath("Package.wxs");
            var packageA64SourceCodeFilePath = packageA_x64.GetInstalledFilePath("Package.wxs");

            // Source file should *not* be installed
            Assert.False(File.Exists(packageA32SourceCodeFilePath), $"PackageA payload should not be there on test start: {packageA32SourceCodeFilePath}");
            Assert.False(File.Exists(packageA64SourceCodeFilePath), $"PackageA_x64 payload should not be there on test start: {packageA64SourceCodeFilePath}");

            multipleBundlePackagesBundle.Install();
            multipleBundlePackagesBundle.VerifyRegisteredAndInPackageCache();

            bundleA.VerifyRegisteredAndInPackageCache();
            bundleB_x64.VerifyRegisteredAndInPackageCache();

            // Source file should be installed
            Assert.True(File.Exists(packageA32SourceCodeFilePath), $"Should have found PackageA payload installed at: {packageA32SourceCodeFilePath}");
            Assert.True(File.Exists(packageA64SourceCodeFilePath), $"Should have found PackageA_x64 payload installed at: {packageA64SourceCodeFilePath}");

            multipleBundlePackagesBundle.Uninstall();
            multipleBundlePackagesBundle.VerifyUnregisteredAndRemovedFromPackageCache();

            bundleA.VerifyUnregisteredAndRemovedFromPackageCache();
            bundleB_x64.VerifyUnregisteredAndRemovedFromPackageCache();

            // Source file should *not* be installed
            Assert.False(File.Exists(packageA32SourceCodeFilePath), $"PackageA payload should have been removed by uninstall from: {packageA32SourceCodeFilePath}");
            Assert.False(File.Exists(packageA64SourceCodeFilePath), $"PackageA_x64 payload should have been removed by uninstall from: {packageA64SourceCodeFilePath}");
        }

        [Fact]
        public void CanInstallUpgradeBundlePackage()
        {
            var bundleAv1 = this.CreateBundleInstaller(@"..\UpgradeRelatedBundleTests\BundleAv1");
            var bundleAv2 = this.CreateBundleInstaller(@"..\UpgradeRelatedBundleTests\BundleAv2");
            var upgradeBundlePackageBundlev2 = this.CreateBundleInstaller("UpgradeBundlePackageBundlev2");

            bundleAv1.Install();
            bundleAv1.VerifyRegisteredAndInPackageCache();

            upgradeBundlePackageBundlev2.Install();
            upgradeBundlePackageBundlev2.VerifyRegisteredAndInPackageCache();
            bundleAv2.VerifyRegisteredAndInPackageCache();
            bundleAv1.VerifyUnregisteredAndRemovedFromPackageCache();
        }

        [Fact]
        public void CanSkipObsoleteBundlePackage()
        {
            var bundleAv1 = this.CreateBundleInstaller(@"..\UpgradeRelatedBundleTests\BundleAv1");
            var bundleAv2 = this.CreateBundleInstaller(@"..\UpgradeRelatedBundleTests\BundleAv2");
            var upgradeBundlePackageBundlev1 = this.CreateBundleInstaller("UpgradeBundlePackageBundlev1");

            bundleAv2.Install();
            bundleAv2.VerifyRegisteredAndInPackageCache();

            upgradeBundlePackageBundlev1.Install();
            upgradeBundlePackageBundlev1.VerifyUnregisteredAndRemovedFromPackageCache();
            bundleAv1.VerifyUnregisteredAndRemovedFromPackageCache();
        }
    }
}