diff options
| author | Rob Mensching <rob@firegiant.com> | 2018-08-11 01:12:28 -0700 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2018-08-11 01:12:28 -0700 |
| commit | f34941825894d44059a560d9f95016ac97803504 (patch) | |
| tree | 2d81fa80cefb53d8a41b335679196d046baff292 /src/test/WixToolsetTest.BuildTasks/WixBuildTaskFixture.cs | |
| parent | c7d69b36789b6403f5b02a975afad80f6b23b48b (diff) | |
| download | wix-f34941825894d44059a560d9f95016ac97803504.tar.gz wix-f34941825894d44059a560d9f95016ac97803504.tar.bz2 wix-f34941825894d44059a560d9f95016ac97803504.zip | |
Fix Build and Clean targets
Diffstat (limited to 'src/test/WixToolsetTest.BuildTasks/WixBuildTaskFixture.cs')
| -rw-r--r-- | src/test/WixToolsetTest.BuildTasks/WixBuildTaskFixture.cs | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/src/test/WixToolsetTest.BuildTasks/WixBuildTaskFixture.cs b/src/test/WixToolsetTest.BuildTasks/WixBuildTaskFixture.cs new file mode 100644 index 00000000..c4a69cdd --- /dev/null +++ b/src/test/WixToolsetTest.BuildTasks/WixBuildTaskFixture.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 class WixBuildTaskFixture | ||
| 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(intermediateFolder, @"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 | } | ||
