| 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.Collections.Generic; |
| 6 | using System.IO; |
| 7 | using WixInternal.TestSupport; |
| 8 | using WixTestTools; |
| 9 | using WixToolset.BootstrapperApplicationApi; |
| 10 | using Xunit; |
| 11 | using Xunit.Abstractions; |
| 12 | |
| 13 | public class VariableTests : BurnE2ETests |
| 14 | { |
| 15 | public VariableTests(ITestOutputHelper testOutputHelper) : base(testOutputHelper) { } |
| 16 | |
| 17 | [RuntimeFact] |
| 18 | public void CanHideHiddenVariables() |
| 19 | { |
| 20 | var packageA = this.CreatePackageInstaller("PackageA"); |
| 21 | var bundleA = this.CreateBundleInstaller("BundleA"); |
| 22 | |
| 23 | packageA.VerifyInstalled(false); |
| 24 | |
| 25 | var logFilePath = bundleA.Install(0, "InstallLocation=nothingtoseehere", "licensekey=supersecretkey"); |
| 26 | bundleA.VerifyRegisteredAndInPackageCache(); |
| 27 | |
| 28 | packageA.VerifyInstalled(true); |
| 29 | |
| 30 | // Burn logging its command line. |
| 31 | Assert.True(LogVerifier.MessageInLogFile(logFilePath, "InstallLocation=nothingtoseehere licensekey=*****")); |
| 32 | // Burn logging the MSI install command line. |
| 33 | Assert.True(LogVerifier.MessageInLogFile(logFilePath, "INSTALLLOCATION=\"nothingtoseehere\" LICENSEKEY=\"*****\" BLANKPROPERTY=\"\"")); |
| 34 | Assert.False(LogVerifier.MessageInLogFile(logFilePath, "supersecretkey")); |
| 35 | } |
| 36 | |
| 37 | [RuntimeFact] |
| 38 | public void CanSupportCaseSensitiveVariables() |
| 39 | { |
| 40 | var packageA = this.CreatePackageInstaller("PackageA"); |
| 41 | var bundleB = this.CreateBundleInstaller("BundleB"); |
| 42 | |
| 43 | packageA.VerifyInstalled(false); |
| 44 | |
| 45 | var logFilePath = bundleB.Install(0, "InstallLocation=nothingtoseehere", "licensekey=supersecretkey"); |
| 46 | bundleB.VerifyRegisteredAndInPackageCache(); |
| 47 | |
| 48 | packageA.VerifyInstalled(true); |
| 49 | |
| 50 | // Burn logging its command line. |
| 51 | Assert.True(LogVerifier.MessageInLogFile(logFilePath, "InstallLocation=nothingtoseehere licensekey=*****")); |
| 52 | // Burn logging the MSI install command line. |
| 53 | Assert.True(LogVerifier.MessageInLogFile(logFilePath, "INSTALLLOCATION=\"\" LICENSEKEY=\"*****\"")); |
| 54 | } |
| 55 | } |
| 56 | } |