diff options
| author | Rob Mensching <rob@firegiant.com> | 2017-12-01 01:09:42 -0800 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2017-12-01 01:09:42 -0800 |
| commit | 720c4a0db1a2fb2aa3e08e5c99d5198873e448ba (patch) | |
| tree | 6794b760149c2f9ff0e01fadc9f2faae5f2c6553 /src/test/WixToolsetTest.CoreIntegration/ExtensionFixture.cs | |
| parent | 5ee1645db44908f67eee90da9cd0197c60711eae (diff) | |
| download | wix-720c4a0db1a2fb2aa3e08e5c99d5198873e448ba.tar.gz wix-720c4a0db1a2fb2aa3e08e5c99d5198873e448ba.tar.bz2 wix-720c4a0db1a2fb2aa3e08e5c99d5198873e448ba.zip | |
Introduce ExampleExtension for testing
Diffstat (limited to 'src/test/WixToolsetTest.CoreIntegration/ExtensionFixture.cs')
| -rw-r--r-- | src/test/WixToolsetTest.CoreIntegration/ExtensionFixture.cs | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/src/test/WixToolsetTest.CoreIntegration/ExtensionFixture.cs b/src/test/WixToolsetTest.CoreIntegration/ExtensionFixture.cs new file mode 100644 index 00000000..5181c748 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/ExtensionFixture.cs | |||
| @@ -0,0 +1,60 @@ | |||
| 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.CoreIntegration | ||
| 4 | { | ||
| 5 | using System; | ||
| 6 | using System.IO; | ||
| 7 | using System.Linq; | ||
| 8 | using Example.Extension; | ||
| 9 | using WixToolset.Core; | ||
| 10 | using WixToolset.Data; | ||
| 11 | using WixToolset.Data.Tuples; | ||
| 12 | using WixToolsetTest.CoreIntegration.Utility; | ||
| 13 | using Xunit; | ||
| 14 | |||
| 15 | public class ExtensionFixture | ||
| 16 | { | ||
| 17 | [Fact] | ||
| 18 | public void CanBuildWithExampleExtension() | ||
| 19 | { | ||
| 20 | var folder = TestData.Get(@"TestData\ExampleExtension"); | ||
| 21 | var extensionPath = Path.GetFullPath(new Uri(typeof(ExampleExtensionFactory).Assembly.CodeBase).LocalPath); | ||
| 22 | |||
| 23 | using (var fs = new DisposableFileSystem()) | ||
| 24 | { | ||
| 25 | var intermediateFolder = fs.GetFolder(); | ||
| 26 | |||
| 27 | var program = new Program(); | ||
| 28 | var result = program.Run(new WixToolsetServiceProvider(), new[] | ||
| 29 | { | ||
| 30 | "build", | ||
| 31 | Path.Combine(folder, "Package.wxs"), | ||
| 32 | Path.Combine(folder, "PackageComponents.wxs"), | ||
| 33 | "-loc", Path.Combine(folder, "Package.en-us.wxl"), | ||
| 34 | "-ext", extensionPath, | ||
| 35 | "-bindpath", Path.Combine(folder, "data"), | ||
| 36 | "-intermediateFolder", intermediateFolder, | ||
| 37 | "-o", Path.Combine(intermediateFolder, @"bin\extest.msi") | ||
| 38 | }); | ||
| 39 | |||
| 40 | Assert.Equal(0, result); | ||
| 41 | |||
| 42 | Assert.True(File.Exists(Path.Combine(intermediateFolder, @"bin\extest.msi"))); | ||
| 43 | Assert.True(File.Exists(Path.Combine(intermediateFolder, @"bin\extest.wixpdb"))); | ||
| 44 | Assert.True(File.Exists(Path.Combine(intermediateFolder, @"bin\MsiPackage\example.txt"))); | ||
| 45 | |||
| 46 | var intermediate = Intermediate.Load(Path.Combine(intermediateFolder, @"bin\extest.wir")); | ||
| 47 | Assert.Single(intermediate.Sections); | ||
| 48 | |||
| 49 | var wixFile = intermediate.Sections.SelectMany(s => s.Tuples).OfType<WixFileTuple>().Single(); | ||
| 50 | Assert.Equal(Path.Combine(folder, @"data\example.txt"), wixFile[WixFileTupleFields.Source].AsPath().Path); | ||
| 51 | Assert.Equal(@"example.txt", wixFile[WixFileTupleFields.Source].PreviousValue.AsPath().Path); | ||
| 52 | |||
| 53 | var example = intermediate.Sections.SelectMany(s => s.Tuples).Where(t => t.Definition.Type == TupleDefinitionType.MustBeFromAnExtension).Single(); | ||
| 54 | Assert.Equal("Foo", example.Id.Id); | ||
| 55 | Assert.Equal("Foo", example[0].AsString()); | ||
| 56 | Assert.Equal("Bar", example[1].AsString()); | ||
| 57 | } | ||
| 58 | } | ||
| 59 | } | ||
| 60 | } | ||
