main
cs 53 lines 2.6 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 WixTestTools;
8 using Xunit;
9 using Xunit.Abstractions;
10
11 public class RollbackBoundaryTests : BurnE2ETests
12 {
13 public RollbackBoundaryTests(ITestOutputHelper testOutputHelper) : base(testOutputHelper) { }
14
15 /// <summary>
16 /// Installs 1 bundle:
17 /// chain - non-vital rollback boundary, package F, package A, vital rollback boundary, package B
18 /// package F fails
19 /// package A and B are permanent
20 /// Execution is supposed to be:
21 /// package F (fails)
22 /// rollback to non-vital rollback boundary which ignores the error and skips over package A
23 /// install package B
24 /// unregister since no non-permanent packages should be installed or cached.
25 /// </summary>
26 [RuntimeFact]
27 public void NonVitalRollbackBoundarySkipsToNextRollbackBoundary()
28 {
29 var packageA = this.CreatePackageInstaller("PackageA");
30 var packageB = this.CreatePackageInstaller("PackageB");
31 this.CreatePackageInstaller("PackageC");
32 this.CreatePackageInstaller("PackageF");
33
34 var bundleA = this.CreateBundleInstaller("BundleA");
35
36 var packageASourceCodeInstalled = packageA.GetInstalledFilePath("Package.wxs");
37 var packageBSourceCodeInstalled = packageB.GetInstalledFilePath("Package.wxs");
38
39 // Source file should *not* be installed
40 Assert.False(File.Exists(packageASourceCodeInstalled), $"Package A payload should not be there on test start: {packageASourceCodeInstalled}");
41 Assert.False(File.Exists(packageBSourceCodeInstalled), $"Package B payload should not be there on test start: {packageBSourceCodeInstalled}");
42
43 bundleA.Install();
44
45 // No non-permanent packages should have ended up installed or cached so it should have unregistered.
46 bundleA.VerifyUnregisteredAndRemovedFromPackageCache();
47
48 // Only PackageB source file should be installed
49 Assert.True(File.Exists(packageBSourceCodeInstalled), String.Concat("Should have found Package B payload installed at: ", packageBSourceCodeInstalled));
50 Assert.False(File.Exists(packageASourceCodeInstalled), String.Concat("Should not have found Package A payload installed at: ", packageASourceCodeInstalled));
51 }
52 }
53 }