summaryrefslogtreecommitdiff
path: root/src/test/burn/WixToolsetTest.BurnE2E/BasicFunctionalityTests.cs
blob: de817e90e65daf5ec29c5b0c95883316e1f628db (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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
// 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;
    using System.IO;
    using WixTestTools;
    using Xunit;
    using Xunit.Abstractions;

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

        [RuntimeFact]
        public void CanInstallAndUninstallSimpleBundle_x86_wixstdba()
        {
            this.CanInstallAndUninstallSimpleBundle("PackageA", "BundleA");
        }

        [RuntimeFact]
        public void CanInstallAndUninstallSimpleBundle_x86_testba()
        {
            this.CanInstallAndUninstallSimpleBundle("PackageA", "BundleB");
        }

        [RuntimeFact]
        public void CanInstallAndUninstallSimpleBundle_x86_dnctestba()
        {
            this.CanInstallAndUninstallSimpleBundle("PackageA", "BundleC");
        }

        [RuntimeFact]
        public void CanInstallAndUninstallSimpleBundle_x86_wixba()
        {
            this.CanInstallAndUninstallSimpleBundle("PackageA", "BundleD");
        }

        [RuntimeFact]
        public void CanInstallAndUninstallSimpleBundle_x64_wixstdba()
        {
            this.CanInstallAndUninstallSimpleBundle("PackageA_x64", "BundleA_x64");
        }

#if DEBUG
        [RuntimeFact(Skip = "0xc0000005 during shutdown from tiptsf.dll")]
#else
        [RuntimeFact]
#endif
        public void CanInstallAndUninstallSimplePerUserBundle_x64_wixstdba()
        {
            this.CanInstallAndUninstallSimpleBundle("PackageApu_x64", "BundleApu_x64", "PackagePerUser.wxs");
        }

        [RuntimeFact]
        public void CanInstallAndUninstallSimpleBundle_x64_testba()
        {
            this.CanInstallAndUninstallSimpleBundle("PackageA_x64", "BundleB_x64");
        }

        [RuntimeFact]
        public void CanInstallAndUninstallSimpleBundle_x64_dnctestba()
        {
            this.CanInstallAndUninstallSimpleBundle("PackageA_x64", "BundleC_x64");
        }

        [RuntimeFact]
        public void CanInstallAndUninstallSimpleBundle_x64_dncwixba()
        {
            this.CanInstallAndUninstallSimpleBundle("PackageA_x64", "BundleD_x64");
        }

        private void CanInstallAndUninstallSimpleBundle(string packageName, string bundleName, string fileName = "Package.wxs")
        {
            var package = this.CreatePackageInstaller(packageName);

            var bundle = this.CreateBundleInstaller(bundleName);

            var packageSourceCodeInstalled = package.GetInstalledFilePath(fileName);

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

            bundle.Install();

            var registration = bundle.VerifyRegisteredAndInPackageCache();
            var cachedBundlePath = registration.CachePath;

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

            bundle.Uninstall(cachedBundlePath);

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

            bundle.VerifyUnregisteredAndRemovedFromPackageCache(cachedBundlePath);
        }
    }
}