| 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 WixInternal.TestSupport; |
| 7 | using WixInternal.Core.TestPackage; |
| 8 | using Xunit; |
| 9 | |
| 10 | public class ShortcutFixture |
| 11 | { |
| 12 | [Fact] |
| 13 | public void CanBuildShortcutNameWithShortname() |
| 14 | { |
| 15 | var folder = TestData.Get(@"TestData"); |
| 16 | |
| 17 | using (var fs = new DisposableFileSystem()) |
| 18 | { |
| 19 | var baseFolder = fs.GetFolder(); |
| 20 | var intermediateFolder = Path.Combine(baseFolder, "obj"); |
| 21 | var msiPath = Path.Combine(baseFolder, @"bin\test.msi"); |
| 22 | |
| 23 | var result = WixRunner.Execute(new[] |
| 24 | { |
| 25 | "build", |
| 26 | Path.Combine(folder, "Shortcut", "ShortcutSameNameShortName.wxs"), |
| 27 | Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), |
| 28 | Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), |
| 29 | "-bindpath", Path.Combine(folder, "SingleFile", "data"), |
| 30 | "-intermediateFolder", intermediateFolder, |
| 31 | "-o", msiPath |
| 32 | }); |
| 33 | |
| 34 | result.AssertSuccess(); |
| 35 | |
| 36 | var results = Query.QueryDatabase(msiPath, new[] { "Shortcut" }); |
| 37 | WixAssert.CompareLineByLine(new[] |
| 38 | { |
| 39 | "Shortcut:sctzJpBYlrhdx4Mm9Xh41X0KPWYiX0\tINSTALLFOLDER\tDaName\tShortcutComp\t[#filcV1yrx0x8wJWj4qMzcH21jwkPko]\t\t\t\t\t\t\t\t\t\t\t", |
| 40 | }, results); |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | [Fact] |
| 45 | public void PopulatesMsiShortcutPropertyTable() |
| 46 | { |
| 47 | var folder = TestData.Get(@"TestData"); |
| 48 | |
| 49 | using (var fs = new DisposableFileSystem()) |
| 50 | { |
| 51 | var baseFolder = fs.GetFolder(); |
| 52 | var intermediateFolder = Path.Combine(baseFolder, "obj"); |
| 53 | var msiPath = Path.Combine(baseFolder, @"bin\test.msi"); |
| 54 | |
| 55 | var result = WixRunner.Execute(new[] |
| 56 | { |
| 57 | "build", |
| 58 | Path.Combine(folder, "Shortcut", "ShortcutProperty.wxs"), |
| 59 | Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), |
| 60 | Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), |
| 61 | "-bindpath", Path.Combine(folder, "SingleFile", "data"), |
| 62 | "-intermediateFolder", intermediateFolder, |
| 63 | "-o", msiPath |
| 64 | }); |
| 65 | |
| 66 | result.AssertSuccess(); |
| 67 | |
| 68 | Assert.True(File.Exists(msiPath)); |
| 69 | var results = Query.QueryDatabase(msiPath, new[] { "MsiShortcutProperty", "Shortcut" }); |
| 70 | WixAssert.CompareLineByLine(new[] |
| 71 | { |
| 72 | "MsiShortcutProperty:scp4GOCIx4Eskci4nBG1MV_vSUOZt4\tTheShortcut\tCustomShortcutKey\tCustomShortcutValue", |
| 73 | "Shortcut:TheShortcut\tINSTALLFOLDER\td\tShortcutComp\t[#filcV1yrx0x8wJWj4qMzcH21jwkPko]\t\t\t\t\t\t\t\t\t\t\t", |
| 74 | }, results); |
| 75 | } |
| 76 | } |
| 77 | } |
| 78 | } |