From 06835732a8e6e9d18d548fbb4487bcaf5c8e1725 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Fri, 13 Jul 2018 15:08:27 -0700 Subject: Fix MSBuild handling of cultures plus add unit tests Fixes #5847 --- .../WixToolsetTest.BuildTasks/MsbuildFixture.cs | 62 ++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 src/test/WixToolsetTest.BuildTasks/MsbuildFixture.cs (limited to 'src/test/WixToolsetTest.BuildTasks/MsbuildFixture.cs') diff --git a/src/test/WixToolsetTest.BuildTasks/MsbuildFixture.cs b/src/test/WixToolsetTest.BuildTasks/MsbuildFixture.cs new file mode 100644 index 00000000..79975f37 --- /dev/null +++ b/src/test/WixToolsetTest.BuildTasks/MsbuildFixture.cs @@ -0,0 +1,62 @@ +// 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.BuildTasks +{ + using System.IO; + using System.Linq; + using Microsoft.Build.Utilities; + using WixBuildTools.TestSupport; + using WixToolset.BuildTasks; + using WixToolset.Data; + using WixToolset.Data.Tuples; + using Xunit; + + public partial class MsbuildFixture + { + [Fact] + public void CanBuildSingleFile() + { + var folder = TestData.Get(@"TestData\SimpleMsiPackage\MsiPackage"); + + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var intermediateFolder = Path.Combine(baseFolder, "obj"); + + var task = new DoIt + { + BuildEngine = new FakeBuildEngine(), + SourceFiles = new[] + { + new TaskItem(Path.Combine(folder, "Package.wxs")), + new TaskItem(Path.Combine(folder, "PackageComponents.wxs")), + }, + LocalizationFiles = new[] + { + new TaskItem(Path.Combine(folder, "Package.en-us.wxl")), + }, + BindInputPaths = new[] + { + new TaskItem(Path.Combine(folder, "data")), + }, + IntermediateDirectory = new TaskItem(intermediateFolder), + OutputFile = new TaskItem(Path.Combine(baseFolder, @"bin\test.msi")), + }; + + var result = task.Execute(); + Assert.True(result, "MSBuild task failed unexpectedly."); + + 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\cab1.cab"))); + + 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\test.txt"), wixFile[WixFileTupleFields.Source].AsPath().Path); + Assert.Equal(@"test.txt", wixFile[WixFileTupleFields.Source].PreviousValue.AsPath().Path); + } + } + } +} -- cgit v1.2.3-55-g6feb