From 301388abc7bfe230630e33bfd96ae4af43d59fb0 Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Mon, 8 Jan 2018 13:12:02 -0500 Subject: Add failing unit test for .NET assemblies --- .../ProgramFixture.cs | 40 +++++++++++++++++++++ .../TestData/Assembly/Package.en-us.wxl | 11 ++++++ .../TestData/Assembly/Package.wxs | 21 +++++++++++ .../TestData/Assembly/PackageComponents.wxs | 10 ++++++ .../TestData/Assembly/data/candle.exe | Bin 0 -> 28672 bytes .../WixToolsetTest.CoreIntegration.csproj | 4 +++ 6 files changed, 86 insertions(+) create mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/Assembly/Package.en-us.wxl create mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/Assembly/Package.wxs create mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/Assembly/PackageComponents.wxs create mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/Assembly/data/candle.exe (limited to 'src') diff --git a/src/test/WixToolsetTest.CoreIntegration/ProgramFixture.cs b/src/test/WixToolsetTest.CoreIntegration/ProgramFixture.cs index a171981a..4af7fc44 100644 --- a/src/test/WixToolsetTest.CoreIntegration/ProgramFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/ProgramFixture.cs @@ -317,6 +317,46 @@ namespace WixToolsetTest.CoreIntegration } } + [Fact] + public void CanBuildWithAssembly() + { + var folder = TestData.Get(@"TestData\Assembly"); + + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var intermediateFolder = Path.Combine(baseFolder, "obj"); + + var program = new Program(); + var result = program.Run(new WixToolsetServiceProvider(), null, new[] + { + "build", + Path.Combine(folder, "Package.wxs"), + Path.Combine(folder, "PackageComponents.wxs"), + "-loc", Path.Combine(folder, "Package.en-us.wxl"), + "-bindpath", Path.Combine(folder, "data"), + "-intermediateFolder", intermediateFolder, + "-o", Path.Combine(baseFolder, @"bin\test.msi") + }); + + Assert.Equal(0, result); + + Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.msi"))); + Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.wixpdb"))); + Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\AssemblyMsiPackage\candle.exe"))); + + var intermediate = Intermediate.Load(Path.Combine(baseFolder, @"bin\test.wir")); + var section = intermediate.Sections.Single(); + + var wixFile = section.Tuples.OfType().Single(); + Assert.Equal(Path.Combine(folder, @"data\candle.exe"), wixFile[WixFileTupleFields.Source].AsPath().Path); + Assert.Equal(@"candle.exe", wixFile[WixFileTupleFields.Source].PreviousValue.AsPath().Path); + + var msiAssemblyNameTuples = section.Tuples.OfType(); + Assert.NotEmpty(msiAssemblyNameTuples); + } + } + [Fact(Skip = "Not implemented yet.")] public void CanBuildInstanceTransform() { diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/Assembly/Package.en-us.wxl b/src/test/WixToolsetTest.CoreIntegration/TestData/Assembly/Package.en-us.wxl new file mode 100644 index 00000000..38c12ac1 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/Assembly/Package.en-us.wxl @@ -0,0 +1,11 @@ + + + + + + A newer version of [ProductName] is already installed. + MsiPackage + + diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/Assembly/Package.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/Assembly/Package.wxs new file mode 100644 index 00000000..d9a2a34e --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/Assembly/Package.wxs @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/Assembly/PackageComponents.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/Assembly/PackageComponents.wxs new file mode 100644 index 00000000..e0c84c63 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/Assembly/PackageComponents.wxs @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/Assembly/data/candle.exe b/src/test/WixToolsetTest.CoreIntegration/TestData/Assembly/data/candle.exe new file mode 100644 index 00000000..18129b73 Binary files /dev/null and b/src/test/WixToolsetTest.CoreIntegration/TestData/Assembly/data/candle.exe differ diff --git a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj index d1901b38..6d11b2d6 100644 --- a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj +++ b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj @@ -44,6 +44,10 @@ + + + + -- cgit v1.2.3-55-g6feb