@joebigelow / wix-1 / commits / 6aa87076

Add failing test around detect only Upgrade.

Sean Hall committed Oct 11, 2019 at 15:35 UTC 6aa87076310c0ad2cb92cabcf2e8bc83c22970be
1 file changed +45
src/test/WixToolsetTest.CoreIntegration/WixlibQueryFixture.cs new
+45
@@ -0,0 +1,45 @@
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.CoreIntegration
4 +{
5 + using System.IO;
6 + using System.Linq;
7 + using WixBuildTools.TestSupport;
8 + using WixToolset.Core.TestPackage;
9 + using WixToolset.Data;
10 + using WixToolset.Data.Tuples;
11 + using Xunit;
12 +
13 + public class WixlibQueryFixture
14 + {
15 + [Fact(Skip = "Test demonstrates failure")]
16 + public void DetectOnlyUpgradeProducesReferenceToRemoveExistingProducts()
17 + {
18 + var folder = TestData.Get(@"TestData\Upgrade");
19 +
20 + using (var fs = new DisposableFileSystem())
21 + {
22 + var baseFolder = fs.GetFolder();
23 + var intermediateFolder = Path.Combine(baseFolder, "obj");
24 +
25 + var result = WixRunner.Execute(new[]
26 + {
27 + "build",
28 + Path.Combine(folder, "DetectOnly.wxs"),
29 + "-intermediateFolder", intermediateFolder,
30 + "-o", Path.Combine(intermediateFolder, @"test.wixlib"),
31 + });
32 +
33 + result.AssertSuccess();
34 +
35 + var intermediate = Intermediate.Load(Path.Combine(intermediateFolder, @"test.wixlib"));
36 + var allTuples = intermediate.Sections.SelectMany(s => s.Tuples);
37 + var wixSimpleRefTuples = allTuples.OfType<WixSimpleReferenceTuple>();
38 + var repRef = wixSimpleRefTuples.Where(t => t.Table == "WixAction" &&
39 + t.PrimaryKeys == "InstallExecuteSequence/RemoveExistingProducts")
40 + .SingleOrDefault();
41 + Assert.NotNull(repRef);
42 + }
43 + }
44 + }
45 +}