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
|
// 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 BundlePackageTests : BurnE2ETests
{
public BundlePackageTests(ITestOutputHelper testOutputHelper) : base(testOutputHelper) { }
[RuntimeFact]
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(expectedSystemComponent: 1);
bundleB_x64.VerifyRegisteredAndInPackageCache(expectedSystemComponent: 1);
// 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}");
}
[RuntimeFact]
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(expectedSystemComponent: 1);
bundleAv1.VerifyUnregisteredAndRemovedFromPackageCache();
}
[RuntimeFact]
public void CanInstallV3BundlePackage()
{
var v3BundleId = "{215a70db-ab35-48c7-be51-d66eaac87177}";
var v3BundleName = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Package Cache", v3BundleId, "CustomV3Theme");
var v3Bundle = new BundleInstaller(this.TestContext, v3BundleName);
this.AddBundleInstaller(v3Bundle);
var v3BundlePackageBundle = this.CreateBundleInstaller("V3BundlePackageBundle");
Assert.False(File.Exists(v3Bundle.Bundle), "v3bundle.exe was already installed");
var logPath = v3BundlePackageBundle.Install();
v3BundlePackageBundle.VerifyRegisteredAndInPackageCache();
Assert.True(LogVerifier.MessageInLogFile(logPath, "Applied execute package: v3bundle.exe, result: 0x0, restart: None"));
Assert.True(BundleRegistration.TryGetPerMachineBundleRegistrationById(v3BundleId, false, out var v3Registration));
Assert.Null(v3Registration.SystemComponent);
}
[RuntimeFact]
public void CanLeaveBundlePackageVisible()
{
var bundleAv1 = this.CreateBundleInstaller(@"..\UpgradeRelatedBundleTests\BundleAv1");
var upgradeBundlePackageBundlev1 = this.CreateBundleInstaller("UpgradeBundlePackageBundlev1");
bundleAv1.Install();
bundleAv1.VerifyRegisteredAndInPackageCache();
upgradeBundlePackageBundlev1.Install();
upgradeBundlePackageBundlev1.VerifyRegisteredAndInPackageCache();
bundleAv1.VerifyRegisteredAndInPackageCache();
upgradeBundlePackageBundlev1.Uninstall();
upgradeBundlePackageBundlev1.VerifyUnregisteredAndRemovedFromPackageCache();
bundleAv1.VerifyRegisteredAndInPackageCache();
}
[RuntimeFact]
public void CanReferenceCountBundlePackage()
{
var bundleAv1 = this.CreateBundleInstaller(@"..\UpgradeRelatedBundleTests\BundleAv1");
var upgradeBundlePackageBundlev1 = this.CreateBundleInstaller("UpgradeBundlePackageBundlev1");
upgradeBundlePackageBundlev1.Install();
upgradeBundlePackageBundlev1.VerifyRegisteredAndInPackageCache();
bundleAv1.VerifyRegisteredAndInPackageCache(expectedSystemComponent: 1);
// Repair bundle so it adds itself as a reference to itself.
bundleAv1.Repair();
bundleAv1.VerifyRegisteredAndInPackageCache();
upgradeBundlePackageBundlev1.Uninstall();
upgradeBundlePackageBundlev1.VerifyUnregisteredAndRemovedFromPackageCache();
bundleAv1.VerifyRegisteredAndInPackageCache();
}
[RuntimeFact]
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();
}
}
}
|