main
cs 108 lines 3.97 KB
Raw
1 // 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.
2
3 namespace WixToolsetTest.BurnE2E
4 {
5 using System;
6 using System.IO;
7 using WixInternal.TestSupport;
8 using WixTestTools;
9 using Xunit;
10 using Xunit.Abstractions;
11
12 public class BasicFunctionalityTests : BurnE2ETests
13 {
14 public BasicFunctionalityTests(ITestOutputHelper testOutputHelper) : base(testOutputHelper) { }
15
16 [RuntimeFact]
17 public void CanInstallAndUninstallSimpleBundle_x86_wixstdba()
18 {
19 this.CanInstallAndUninstallSimpleBundle("PackageA", "BundleA");
20 }
21
22 [RuntimeFact]
23 public void CanInstallAndUninstallSimpleBundle_x86_testba()
24 {
25 this.CanInstallAndUninstallSimpleBundle("PackageA", "BundleB");
26 }
27
28 [RuntimeFact]
29 public void CanInstallAndUninstallSimpleBundle_x86_dnctestba()
30 {
31 this.CanInstallAndUninstallSimpleBundle("PackageA", "BundleC");
32 }
33
34 [RuntimeFact]
35 public void CanInstallAndUninstallSimpleBundle_x86_wixba()
36 {
37 this.CanInstallAndUninstallSimpleBundle("PackageA", "BundleD");
38 }
39
40 [RuntimeFact]
41 public void CanInstallAndUninstallSimpleBundle_x64_wixstdba()
42 {
43 this.CanInstallAndUninstallSimpleBundle("PackageA_x64", "BundleA_x64");
44 }
45
46 [RuntimeFact]
47 public void CanInstallAndUninstallSimplePerUserBundle_x64_wixstdba()
48 {
49 this.CanInstallAndUninstallSimpleBundle("PackageApu_x64", "BundleApu_x64", "PackagePerUser.wxs", unchecked((int)0xc0000005));
50 }
51
52 [RuntimeFact]
53 public void CanInstallAndUninstallSimpleBundle_x64_testba()
54 {
55 this.CanInstallAndUninstallSimpleBundle("PackageA_x64", "BundleB_x64");
56 }
57
58 [RuntimeFact]
59 public void CanInstallAndUninstallSimpleBundle_x64_dnctestba()
60 {
61 this.CanInstallAndUninstallSimpleBundle("PackageA_x64", "BundleC_x64");
62 }
63
64 [RuntimeFact]
65 public void CanInstallAndUninstallSimpleBundle_x64_dncwixba()
66 {
67 this.CanInstallAndUninstallSimpleBundle("PackageA_x64", "BundleD_x64");
68 }
69
70 private void CanInstallAndUninstallSimpleBundle(string packageName, string bundleName, string fileName = "Package.wxs", int? alternateExitCode = null)
71 {
72 var package = this.CreatePackageInstaller(packageName);
73
74 var bundle = this.CreateBundleInstaller(bundleName);
75 bundle.AlternateExitCode = alternateExitCode;
76
77 var packageSourceCodeInstalled = package.GetInstalledFilePath(fileName);
78
79 // Source file should *not* be installed
80 Assert.False(File.Exists(packageSourceCodeInstalled), $"{packageName} payload should not be there on test start: {packageSourceCodeInstalled}");
81
82 bundle.Install();
83
84 var registration = bundle.VerifyRegisteredAndInPackageCache();
85 var cachedBundlePath = registration.CachePath;
86
87 // Source file should be installed
88 Assert.True(File.Exists(packageSourceCodeInstalled), $"Should have found {packageName} payload installed at: {packageSourceCodeInstalled}");
89
90 if (alternateExitCode == bundle.LastExitCode)
91 {
92 WixAssert.Skip($"Install exited with {bundle.LastExitCode}");
93 }
94
95 bundle.Uninstall(cachedBundlePath);
96
97 // Source file should *not* be installed
98 Assert.False(File.Exists(packageSourceCodeInstalled), $"{packageName} payload should have been removed by uninstall from: {packageSourceCodeInstalled}");
99
100 bundle.VerifyUnregisteredAndRemovedFromPackageCache(cachedBundlePath);
101
102 if (alternateExitCode == bundle.LastExitCode)
103 {
104 WixAssert.Skip($"Uninstall exited with {bundle.LastExitCode}");
105 }
106 }
107 }
108 }