aboutsummaryrefslogtreecommitdiff
path: root/src/test/burn/WixToolsetTest.BurnE2E/VariableTests.cs
blob: 57224c6810df6d47e19737c492f7d7eca06f2b84 (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
// 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.Collections.Generic;
    using System.IO;
    using WixInternal.TestSupport;
    using WixTestTools;
    using WixToolset.BootstrapperApplicationApi;
    using Xunit;
    using Xunit.Abstractions;

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

        [RuntimeFact]
        public void CanHideHiddenVariables()
        {
            var packageA = this.CreatePackageInstaller("PackageA");
            var bundleA = this.CreateBundleInstaller("BundleA");

            packageA.VerifyInstalled(false);

            var logFilePath = bundleA.Install(0, "InstallLocation=nothingtoseehere", "licensekey=supersecretkey");
            bundleA.VerifyRegisteredAndInPackageCache();

            packageA.VerifyInstalled(true);

            // Burn logging its command line.
            Assert.True(LogVerifier.MessageInLogFile(logFilePath, "InstallLocation=nothingtoseehere licensekey=*****"));
            // Burn logging the MSI install command line.
            Assert.True(LogVerifier.MessageInLogFile(logFilePath, "INSTALLLOCATION=\"nothingtoseehere\" LICENSEKEY=\"*****\" BLANKPROPERTY=\"\""));
            Assert.False(LogVerifier.MessageInLogFile(logFilePath, "supersecretkey"));
        }

        [RuntimeFact]
        public void CanSupportCaseSensitiveVariables()
        {
            var packageA = this.CreatePackageInstaller("PackageA");
            var bundleB = this.CreateBundleInstaller("BundleB");

            packageA.VerifyInstalled(false);

            var logFilePath = bundleB.Install(0, "InstallLocation=nothingtoseehere", "licensekey=supersecretkey");
            bundleB.VerifyRegisteredAndInPackageCache();

            packageA.VerifyInstalled(true);

            // Burn logging its command line.
            Assert.True(LogVerifier.MessageInLogFile(logFilePath, "InstallLocation=nothingtoseehere licensekey=*****"));
            // Burn logging the MSI install command line.
            Assert.True(LogVerifier.MessageInLogFile(logFilePath, "INSTALLLOCATION=\"\" LICENSEKEY=\"*****\""));
        }
    }
}