diff options
| author | Bob Arnson <bob@joyofsetup.com> | 2019-10-23 21:25:57 -0400 |
|---|---|---|
| committer | Bob Arnson <bob@firegiant.com> | 2019-10-23 21:36:29 -0400 |
| commit | da8727b126a3dc358c9d265c6e183b151ed8ec44 (patch) | |
| tree | 47935c153385429aacbcf1aa171d0c6af37ae57c /src/test/WixToolsetTest.Util/UtilExtensionFixture.cs | |
| parent | c9546f882bde36d5b525f82280a1e09f81c08845 (diff) | |
| download | wix-da8727b126a3dc358c9d265c6e183b151ed8ec44.tar.gz wix-da8727b126a3dc358c9d265c6e183b151ed8ec44.tar.bz2 wix-da8727b126a3dc358c9d265c6e183b151ed8ec44.zip | |
Use strongly-typed tuple creation...
...especially for tuples shared with WixToolset.Data.
Add bundle tests.
Diffstat (limited to 'src/test/WixToolsetTest.Util/UtilExtensionFixture.cs')
| -rw-r--r-- | src/test/WixToolsetTest.Util/UtilExtensionFixture.cs | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/src/test/WixToolsetTest.Util/UtilExtensionFixture.cs b/src/test/WixToolsetTest.Util/UtilExtensionFixture.cs index 74cf9769..f2f06af8 100644 --- a/src/test/WixToolsetTest.Util/UtilExtensionFixture.cs +++ b/src/test/WixToolsetTest.Util/UtilExtensionFixture.cs | |||
| @@ -2,9 +2,12 @@ | |||
| 2 | 2 | ||
| 3 | namespace WixToolsetTest.Util | 3 | namespace WixToolsetTest.Util |
| 4 | { | 4 | { |
| 5 | using System.IO; | ||
| 5 | using System.Linq; | 6 | using System.Linq; |
| 6 | using WixBuildTools.TestSupport; | 7 | using WixBuildTools.TestSupport; |
| 7 | using WixToolset.Core.TestPackage; | 8 | using WixToolset.Core.TestPackage; |
| 9 | using WixToolset.Data; | ||
| 10 | using WixToolset.Data.Tuples; | ||
| 8 | using WixToolset.Util; | 11 | using WixToolset.Util; |
| 9 | using Xunit; | 12 | using Xunit; |
| 10 | 13 | ||
| @@ -24,6 +27,70 @@ namespace WixToolsetTest.Util | |||
| 24 | }, results.OrderBy(s => s).ToArray()); | 27 | }, results.OrderBy(s => s).ToArray()); |
| 25 | } | 28 | } |
| 26 | 29 | ||
| 30 | [Fact] | ||
| 31 | public void CanBuildBundleWithSearches() | ||
| 32 | { | ||
| 33 | var burnStubPath = TestData.Get(@"TestData\.Data\burn.exe"); | ||
| 34 | var folder = TestData.Get(@"TestData\BundleWithSearches"); | ||
| 35 | var rootFolder = TestData.Get(); | ||
| 36 | var wixext = Path.Combine(rootFolder, "WixToolset.Util.wixext.dll"); | ||
| 37 | |||
| 38 | using (var fs = new DisposableFileSystem()) | ||
| 39 | { | ||
| 40 | var baseFolder = fs.GetFolder(); | ||
| 41 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
| 42 | |||
| 43 | var result = WixRunner.Execute(new[] | ||
| 44 | { | ||
| 45 | "build", | ||
| 46 | Path.Combine(folder, "Bundle.wxs"), | ||
| 47 | "-ext", wixext, | ||
| 48 | "-loc", Path.Combine(folder, "Bundle.en-us.wxl"), | ||
| 49 | "-bindpath", Path.Combine(folder, "data"), | ||
| 50 | "-intermediateFolder", intermediateFolder, | ||
| 51 | "-burnStub", burnStubPath, | ||
| 52 | "-o", Path.Combine(baseFolder, @"bin\test.exe") | ||
| 53 | }); | ||
| 54 | |||
| 55 | result.AssertSuccess(); | ||
| 56 | |||
| 57 | Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.exe"))); | ||
| 58 | #if TODO | ||
| 59 | Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.wixpdb"))); | ||
| 60 | #endif | ||
| 61 | |||
| 62 | var intermediate = Intermediate.Load(Path.Combine(intermediateFolder, @"test.wir")); | ||
| 63 | var section = intermediate.Sections.Single(); | ||
| 64 | |||
| 65 | var searchTuples = section.Tuples.OfType<WixSearchTuple>().OrderBy(t => t.Id.Id).ToList(); | ||
| 66 | Assert.Equal(3, searchTuples.Count); | ||
| 67 | Assert.Equal("FileSearchId", searchTuples[0].Id.Id); | ||
| 68 | Assert.Equal("FileSearchVariable", searchTuples[0].Variable); | ||
| 69 | Assert.Equal("ProductSearchId", searchTuples[1].Id.Id); | ||
| 70 | Assert.Equal("ProductSearchVariable", searchTuples[1].Variable); | ||
| 71 | Assert.Equal("1 & 2 < 3", searchTuples[1].Condition); | ||
| 72 | Assert.Equal("RegistrySearchId", searchTuples[2].Id.Id); | ||
| 73 | Assert.Equal("RegistrySearchVariable", searchTuples[2].Variable); | ||
| 74 | |||
| 75 | var fileSearchTuple = section.Tuples.OfType<WixFileSearchTuple>().Single(); | ||
| 76 | Assert.Equal("FileSearchId", fileSearchTuple.Id.Id); | ||
| 77 | Assert.Equal(@"%windir%\System32\mscoree.dll", fileSearchTuple.Path); | ||
| 78 | Assert.Equal(WixFileSearchAttributes.Default | WixFileSearchAttributes.WantExists, fileSearchTuple.Attributes); | ||
| 79 | |||
| 80 | var productSearchTuple = section.Tuples.OfType<WixProductSearchTuple>().Single(); | ||
| 81 | Assert.Equal("ProductSearchId", productSearchTuple.Id.Id); | ||
| 82 | Assert.Equal("{738D02BF-E231-4370-8209-E9FD4E1BE2A1}", productSearchTuple.Guid); | ||
| 83 | Assert.Equal(WixProductSearchAttributes.Version | WixProductSearchAttributes.UpgradeCode, productSearchTuple.Attributes); | ||
| 84 | |||
| 85 | var registrySearchTuple = section.Tuples.OfType<WixRegistrySearchTuple>().Single(); | ||
| 86 | Assert.Equal("RegistrySearchId", registrySearchTuple.Id.Id); | ||
| 87 | Assert.Equal(RegistryRootType.LocalMachine, registrySearchTuple.Root); | ||
| 88 | Assert.Equal(@"SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full", registrySearchTuple.Key); | ||
| 89 | Assert.Equal("Release", registrySearchTuple.Value); | ||
| 90 | Assert.Equal(WixRegistrySearchAttributes.WantValue | WixRegistrySearchAttributes.Raw, registrySearchTuple.Attributes); | ||
| 91 | } | ||
| 92 | } | ||
| 93 | |||
| 27 | private static void Build(string[] args) | 94 | private static void Build(string[] args) |
| 28 | { | 95 | { |
| 29 | var result = WixRunner.Execute(args) | 96 | var result = WixRunner.Execute(args) |
