| 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.Core.TestPackage; |
| 7 | using WixInternal.TestSupport; |
| 8 | using Xunit; |
| 9 | |
| 10 | public class AppIdFixture |
| 11 | { |
| 12 | [Fact] |
| 13 | public void PopulatesAppIdTableAtTopLevel() |
| 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, "AppId", "TopLevelAppId.wxs"), |
| 27 | "-bindpath", Path.Combine(folder, "SingleFile", "data"), |
| 28 | "-intermediateFolder", intermediateFolder, |
| 29 | "-o", msiPath |
| 30 | }); |
| 31 | |
| 32 | result.AssertSuccess(); |
| 33 | |
| 34 | Assert.True(File.Exists(msiPath)); |
| 35 | var results = Query.QueryDatabase(msiPath, new[] { "AppId" }); |
| 36 | WixAssert.CompareLineByLine(new[] |
| 37 | { |
| 38 | "AppId:{D6040299-B15C-4C94-AE26-0C9B60D14C35}\t\t\t\t\t\t", |
| 39 | }, results); |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | [Fact] |
| 44 | public void PopulatesAppIdTableWhenAdvertised() |
| 45 | { |
| 46 | var folder = TestData.Get(@"TestData"); |
| 47 | |
| 48 | using (var fs = new DisposableFileSystem()) |
| 49 | { |
| 50 | var baseFolder = fs.GetFolder(); |
| 51 | var intermediateFolder = Path.Combine(baseFolder, "obj"); |
| 52 | var msiPath = Path.Combine(baseFolder, @"bin", "test.msi"); |
| 53 | |
| 54 | var result = WixRunner.Execute(new[] |
| 55 | { |
| 56 | "build", |
| 57 | Path.Combine(folder, "AppId", "Advertised.wxs"), |
| 58 | Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), |
| 59 | Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), |
| 60 | "-bindpath", Path.Combine(folder, "SingleFile", "data"), |
| 61 | "-intermediateFolder", intermediateFolder, |
| 62 | "-o", msiPath |
| 63 | }); |
| 64 | |
| 65 | result.AssertSuccess(); |
| 66 | |
| 67 | Assert.True(File.Exists(msiPath)); |
| 68 | var results = Query.QueryDatabase(msiPath, new[] { "AppId" }); |
| 69 | WixAssert.CompareLineByLine(new[] |
| 70 | { |
| 71 | "AppId:{D6040299-B15C-4C94-AE26-0C9B60D14C35}\t\t\t\t\t\t", |
| 72 | }, results); |
| 73 | } |
| 74 | } |
| 75 | } |
| 76 | } |