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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
// 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.Bal
{
using System.IO;
using System.Linq;
using System.Xml;
using WixBuildTools.TestSupport;
using WixToolset.Core.TestPackage;
using Xunit;
public class BalExtensionFixture
{
[Fact]
public void CanBuildUsingDisplayInternalUICondition()
{
using (var fs = new DisposableFileSystem())
{
var baseFolder = fs.GetFolder();
var bundleFile = Path.Combine(baseFolder, "bin", "test.exe");
var bundleSourceFolder = TestData.Get(@"TestData\WixStdBa");
var intermediateFolder = Path.Combine(baseFolder, "obj");
var baFolderPath = Path.Combine(baseFolder, "ba");
var extractFolderPath = Path.Combine(baseFolder, "extract");
var compileResult = WixRunner.Execute(new[]
{
"build",
Path.Combine(bundleSourceFolder, "DisplayInternalUIConditionBundle.wxs"),
"-ext", TestData.Get(@"WixToolset.Bal.wixext.dll"),
"-intermediateFolder", intermediateFolder,
"-bindpath", Path.Combine(bundleSourceFolder, "data"),
"-o", bundleFile,
});
compileResult.AssertSuccess();
Assert.True(File.Exists(bundleFile));
var extractResult = BundleExtractor.ExtractBAContainer(null, bundleFile, baFolderPath, extractFolderPath);
extractResult.AssertSuccess();
var balPackageInfos = extractResult.SelectBADataNodes("/ba:BootstrapperApplicationData/ba:WixBalPackageInfo");
var balPackageInfo = (XmlNode)Assert.Single(balPackageInfos);
Assert.Equal("<WixBalPackageInfo PackageId='test.msi' DisplayInternalUICondition='1' />", balPackageInfo.GetTestXml());
}
}
[Fact]
public void CanBuildUsingWixStdBa()
{
using (var fs = new DisposableFileSystem())
{
var baseFolder = fs.GetFolder();
var bundleFile = Path.Combine(baseFolder, "bin", "test.exe");
var bundleSourceFolder = TestData.Get(@"TestData\WixStdBa");
var intermediateFolder = Path.Combine(baseFolder, "obj");
var compileResult = WixRunner.Execute(new[]
{
"build",
Path.Combine(bundleSourceFolder, "Bundle.wxs"),
"-ext", TestData.Get(@"WixToolset.Bal.wixext.dll"),
"-intermediateFolder", intermediateFolder,
"-o", bundleFile,
});
compileResult.AssertSuccess();
Assert.True(File.Exists(bundleFile));
}
}
[Fact]
public void CantBuildUsingMBAWithNoPrereqs()
{
using (var fs = new DisposableFileSystem())
{
var baseFolder = fs.GetFolder();
var bundleFile = Path.Combine(baseFolder, "bin", "test.exe");
var bundleSourceFolder = TestData.Get(@"TestData\MBA");
var intermediateFolder = Path.Combine(baseFolder, "obj");
var compileResult = WixRunner.Execute(new[]
{
"build",
Path.Combine(bundleSourceFolder, "Bundle.wxs"),
"-ext", TestData.Get(@"WixToolset.Bal.wixext.dll"),
"-ext", TestData.Get(@"WixToolset.NetFx.wixext.dll"),
"-intermediateFolder", intermediateFolder,
"-o", bundleFile,
});
Assert.Equal(6802, compileResult.ExitCode);
Assert.Equal("There must be at least one PrereqPackage when using the ManagedBootstrapperApplicationHost.\nThis is typically done by using the WixNetFxExtension and referencing one of the NetFxAsPrereq package groups.", compileResult.Messages[0].ToString());
Assert.False(File.Exists(bundleFile));
Assert.False(File.Exists(Path.Combine(intermediateFolder, "test.exe")));
}
}
}
}
|