diff options
| author | Rob Mensching <rob@firegiant.com> | 2018-07-21 07:36:34 -0700 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2018-07-21 07:36:34 -0700 |
| commit | 306f1d0c528cb6c151594ff96a41b5c01a5c4d9b (patch) | |
| tree | 95deb0884b59decc082eae7adf5d65d45c5f3848 /src/test/WixToolsetTest.BuildTasks/MsbuildFixture.cs | |
| parent | 6fc54af07b10742e883f3a39ef0114e55e6a36a0 (diff) | |
| download | wix-306f1d0c528cb6c151594ff96a41b5c01a5c4d9b.tar.gz wix-306f1d0c528cb6c151594ff96a41b5c01a5c4d9b.tar.bz2 wix-306f1d0c528cb6c151594ff96a41b5c01a5c4d9b.zip | |
Integrate tools from Core project
Diffstat (limited to 'src/test/WixToolsetTest.BuildTasks/MsbuildFixture.cs')
| -rw-r--r-- | src/test/WixToolsetTest.BuildTasks/MsbuildFixture.cs | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/src/test/WixToolsetTest.BuildTasks/MsbuildFixture.cs b/src/test/WixToolsetTest.BuildTasks/MsbuildFixture.cs new file mode 100644 index 00000000..a27928d5 --- /dev/null +++ b/src/test/WixToolsetTest.BuildTasks/MsbuildFixture.cs | |||
| @@ -0,0 +1,64 @@ | |||
| 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.BuildTasks | ||
| 4 | { | ||
| 5 | using System.IO; | ||
| 6 | using System.Linq; | ||
| 7 | using Microsoft.Build.Utilities; | ||
| 8 | using WixBuildTools.TestSupport; | ||
| 9 | using WixToolset.BuildTasks; | ||
| 10 | using WixToolset.Data; | ||
| 11 | using WixToolset.Data.Tuples; | ||
| 12 | using Xunit; | ||
| 13 | |||
| 14 | public partial class MsbuildFixture | ||
| 15 | { | ||
| 16 | [Fact] | ||
| 17 | public void CanBuildSimpleMsiPackage() | ||
| 18 | { | ||
| 19 | var folder = TestData.Get(@"TestData\SimpleMsiPackage\MsiPackage"); | ||
| 20 | |||
| 21 | using (var fs = new DisposableFileSystem()) | ||
| 22 | { | ||
| 23 | var baseFolder = fs.GetFolder(); | ||
| 24 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
| 25 | |||
| 26 | var engine = new FakeBuildEngine(); | ||
| 27 | |||
| 28 | var task = new DoIt | ||
| 29 | { | ||
| 30 | BuildEngine = engine, | ||
| 31 | SourceFiles = new[] | ||
| 32 | { | ||
| 33 | new TaskItem(Path.Combine(folder, "Package.wxs")), | ||
| 34 | new TaskItem(Path.Combine(folder, "PackageComponents.wxs")), | ||
| 35 | }, | ||
| 36 | LocalizationFiles = new[] | ||
| 37 | { | ||
| 38 | new TaskItem(Path.Combine(folder, "Package.en-us.wxl")), | ||
| 39 | }, | ||
| 40 | BindInputPaths = new[] | ||
| 41 | { | ||
| 42 | new TaskItem(Path.Combine(folder, "data")), | ||
| 43 | }, | ||
| 44 | IntermediateDirectory = new TaskItem(intermediateFolder), | ||
| 45 | OutputFile = new TaskItem(Path.Combine(baseFolder, @"bin\test.msi")), | ||
| 46 | }; | ||
| 47 | |||
| 48 | var result = task.Execute(); | ||
| 49 | Assert.True(result, $"MSBuild task failed unexpectedly. Output:\r\n{engine.Output}"); | ||
| 50 | |||
| 51 | Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.msi"))); | ||
| 52 | Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.wixpdb"))); | ||
| 53 | Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\cab1.cab"))); | ||
| 54 | |||
| 55 | var intermediate = Intermediate.Load(Path.Combine(baseFolder, @"bin\test.wir")); | ||
| 56 | var section = intermediate.Sections.Single(); | ||
| 57 | |||
| 58 | var wixFile = section.Tuples.OfType<WixFileTuple>().Single(); | ||
| 59 | Assert.Equal(Path.Combine(folder, @"data\test.txt"), wixFile[WixFileTupleFields.Source].AsPath().Path); | ||
| 60 | Assert.Equal(@"test.txt", wixFile[WixFileTupleFields.Source].PreviousValue.AsPath().Path); | ||
| 61 | } | ||
| 62 | } | ||
| 63 | } | ||
| 64 | } | ||
