aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolsetTest.BurnE2E/BasicFunctionalityTests.cs
blob: 5df86fffed00882726966f790ee83998a1ca6cbf (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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
// 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 Xunit;
    using Xunit.Abstractions;

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

        [Fact]
        public void CanInstallAndUninstallSimpleBundle_x86_wixstdba()
        {
            var packageA = this.CreatePackageInstaller("PackageA");

            var bundleA = this.CreateBundleInstaller("BundleA");

            var packageASourceCodeInstalled = packageA.GetInstalledFilePath("Package.wxs");

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

            bundleA.Install();

            var cachedBundlePath = bundleA.VerifyRegisteredAndInPackageCache();

            // Source file should be installed
            Assert.True(File.Exists(packageASourceCodeInstalled), String.Concat("Should have found Package A payload installed at: ", packageASourceCodeInstalled));

            bundleA.Uninstall(cachedBundlePath);

            // Source file should *not* be installed
            Assert.False(File.Exists(packageASourceCodeInstalled), String.Concat("Package A payload should have been removed by uninstall from: ", packageASourceCodeInstalled));

            bundleA.VerifyUnregisteredAndRemovedFromPackageCache(cachedBundlePath);
        }

        [Fact]
        public void CanInstallAndUninstallSimpleBundle_x86_testba()
        {
            var packageA = this.CreatePackageInstaller("PackageA");

            var bundleB = this.CreateBundleInstaller("BundleB");

            var packageASourceCodeInstalled = packageA.GetInstalledFilePath("Package.wxs");

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

            bundleB.Install();

            var cachedBundlePath = bundleB.VerifyRegisteredAndInPackageCache();

            // Source file should be installed
            Assert.True(File.Exists(packageASourceCodeInstalled), String.Concat("Should have found Package A payload installed at: ", packageASourceCodeInstalled));

            bundleB.Uninstall(cachedBundlePath);

            // Source file should *not* be installed
            Assert.False(File.Exists(packageASourceCodeInstalled), String.Concat("Package A payload should have been removed by uninstall from: ", packageASourceCodeInstalled));

            bundleB.VerifyUnregisteredAndRemovedFromPackageCache(cachedBundlePath);
        }

        [Fact]
        public void CanInstallAndUninstallSimpleBundle_x86_dnctestba()
        {
            var packageA = this.CreatePackageInstaller("PackageA");

            var bundleC = this.CreateBundleInstaller("BundleC");

            var packageASourceCodeInstalled = packageA.GetInstalledFilePath("Package.wxs");

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

            bundleC.Install();

            var cachedBundlePath = bundleC.VerifyRegisteredAndInPackageCache();

            // Source file should be installed
            Assert.True(File.Exists(packageASourceCodeInstalled), String.Concat("Should have found Package A payload installed at: ", packageASourceCodeInstalled));

            bundleC.Uninstall(cachedBundlePath);

            // Source file should *not* be installed
            Assert.False(File.Exists(packageASourceCodeInstalled), String.Concat("Package A payload should have been removed by uninstall from: ", packageASourceCodeInstalled));

            bundleC.VerifyUnregisteredAndRemovedFromPackageCache(cachedBundlePath);
        }

        [Fact]
        public void CanInstallAndUninstallSimpleBundle_x64_wixstdba()
        {
            var packageA_x64 = this.CreatePackageInstaller("PackageA_x64");

            var bundleA_x64 = this.CreateBundleInstaller("BundleA_x64");

            var packageASourceCodeInstalled = packageA_x64.GetInstalledFilePath("Package.wxs");

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

            bundleA_x64.Install();

            var cachedBundlePath = bundleA_x64.VerifyRegisteredAndInPackageCache();

            // Source file should be installed
            Assert.True(File.Exists(packageASourceCodeInstalled), String.Concat("Should have found Package A x64 payload installed at: ", packageASourceCodeInstalled));

            bundleA_x64.Uninstall(cachedBundlePath);

            // Source file should *not* be installed
            Assert.False(File.Exists(packageASourceCodeInstalled), String.Concat("Package A x64 payload should have been removed by uninstall from: ", packageASourceCodeInstalled));

            bundleA_x64.VerifyUnregisteredAndRemovedFromPackageCache(cachedBundlePath);
        }

        [Fact]
        public void CanInstallAndUninstallSimpleBundle_x64_testba()
        {
            var packageA_x64 = this.CreatePackageInstaller("PackageA_x64");

            var bundleB_x64 = this.CreateBundleInstaller("BundleB_x64");

            var packageASourceCodeInstalled = packageA_x64.GetInstalledFilePath("Package.wxs");

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

            bundleB_x64.Install();

            var cachedBundlePath = bundleB_x64.VerifyRegisteredAndInPackageCache();

            // Source file should be installed
            Assert.True(File.Exists(packageASourceCodeInstalled), String.Concat("Should have found Package A x64 payload installed at: ", packageASourceCodeInstalled));

            bundleB_x64.Uninstall(cachedBundlePath);

            // Source file should *not* be installed
            Assert.False(File.Exists(packageASourceCodeInstalled), String.Concat("Package A x64 payload should have been removed by uninstall from: ", packageASourceCodeInstalled));

            bundleB_x64.VerifyUnregisteredAndRemovedFromPackageCache(cachedBundlePath);
        }

        [Fact]
        public void CanInstallAndUninstallSimpleBundle_x64_dnctestba()
        {
            var packageA_x64 = this.CreatePackageInstaller("PackageA_x64");

            var bundleC_x64 = this.CreateBundleInstaller("BundleC_x64");

            var packageASourceCodeInstalled = packageA_x64.GetInstalledFilePath("Package.wxs");

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

            bundleC_x64.Install();

            var cachedBundlePath = bundleC_x64.VerifyRegisteredAndInPackageCache();

            // Source file should be installed
            Assert.True(File.Exists(packageASourceCodeInstalled), String.Concat("Should have found Package A x64 payload installed at: ", packageASourceCodeInstalled));

            bundleC_x64.Uninstall(cachedBundlePath);

            // Source file should *not* be installed
            Assert.False(File.Exists(packageASourceCodeInstalled), String.Concat("Package A x64 payload should have been removed by uninstall from: ", packageASourceCodeInstalled));

            bundleC_x64.VerifyUnregisteredAndRemovedFromPackageCache(cachedBundlePath);
        }
    }
}