From 1b266e62a450813718d0ff1c78f4470055adc5f3 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Mon, 30 Sep 2019 09:34:40 +1000 Subject: Add failing tests for AppSearch tables. --- .../MsiQueryFixture.cs | 137 +++++++++++++++++++++ .../TestData/AppSearch/ComponentSearch.wxs | 12 ++ .../TestData/AppSearch/DirectorySearch.wxs | 12 ++ .../TestData/AppSearch/FileSearch.wxs | 14 +++ .../TestData/AppSearch/RegistrySearch.wxs | 12 ++ .../WixToolsetTest.CoreIntegration.csproj | 4 + 6 files changed, 191 insertions(+) create mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/AppSearch/ComponentSearch.wxs create mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/AppSearch/DirectorySearch.wxs create mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/AppSearch/FileSearch.wxs create mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/AppSearch/RegistrySearch.wxs diff --git a/src/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs b/src/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs index 7c53d72f..e7443f35 100644 --- a/src/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs @@ -9,6 +9,143 @@ namespace WixToolsetTest.CoreIntegration public class MsiQueryFixture { + [Fact(Skip = "Test demonstrates failure")] + public void PopulatesAppSearchTablesFromComponentSearch() + { + var folder = TestData.Get(@"TestData"); + + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var intermediateFolder = Path.Combine(baseFolder, "obj"); + var msiPath = Path.Combine(baseFolder, @"bin\test.msi"); + + var result = WixRunner.Execute(new[] + { + "build", + Path.Combine(folder, "AppSearch", "ComponentSearch.wxs"), + Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), + Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), + "-bindpath", Path.Combine(folder, "SingleFile", "data"), + "-intermediateFolder", intermediateFolder, + "-o", msiPath + }); + + result.AssertSuccess(); + + Assert.True(File.Exists(msiPath)); + var results = Query.QueryDatabase(msiPath, new[] { "AppSearch", "CompLocator" }); + Assert.Equal(new[] + { + "AppSearch:SAMPLECOMPFOUND\tSampleCompSearch", + "CompLocator:SampleCompSearch\t{4D9A0D20-D0CC-40DE-B580-EAD38B985217}\t1", + }, results); + } + } + + [Fact(Skip = "Test demonstrates failure")] + public void PopulatesAppSearchTablesFromDirectorySearch() + { + var folder = TestData.Get(@"TestData"); + + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var intermediateFolder = Path.Combine(baseFolder, "obj"); + var msiPath = Path.Combine(baseFolder, @"bin\test.msi"); + + var result = WixRunner.Execute(new[] + { + "build", + Path.Combine(folder, "AppSearch", "DirectorySearch.wxs"), + Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), + Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), + "-bindpath", Path.Combine(folder, "SingleFile", "data"), + "-intermediateFolder", intermediateFolder, + "-o", msiPath + }); + + result.AssertSuccess(); + + Assert.True(File.Exists(msiPath)); + var results = Query.QueryDatabase(msiPath, new[] { "AppSearch", "DrLocator" }); + Assert.Equal(new[] + { + "AppSearch:SAMPLECOMPFOUND\tSampleCompSearch", + "DrLocator:SampleDirSearch\t\tC:\\SampleDir\t", + }, results); + } + } + + [Fact(Skip = "Test demonstrates failure")] + public void PopulatesAppSearchTablesFromFileSearch() + { + var folder = TestData.Get(@"TestData"); + + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var intermediateFolder = Path.Combine(baseFolder, "obj"); + var msiPath = Path.Combine(baseFolder, @"bin\test.msi"); + + var result = WixRunner.Execute(new[] + { + "build", + Path.Combine(folder, "AppSearch", "FileSearch.wxs"), + Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), + Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), + "-bindpath", Path.Combine(folder, "SingleFile", "data"), + "-intermediateFolder", intermediateFolder, + "-o", msiPath + }); + + result.AssertSuccess(); + + Assert.True(File.Exists(msiPath)); + var results = Query.QueryDatabase(msiPath, new[] { "AppSearch", "DrLocator", "IniLocator" }); + Assert.Equal(new[] + { + "AppSearch:SAMPLEFILEFOUND\tSampleFileSearch", + "DrLocator:SampleFileSearch\tSampleIniFileSearch\t\t", + "IniLocator:SampleFileSearch\tsample.fil\tMySection\tMyKey\t\t1", + }, results); + } + } + + [Fact(Skip = "Test demonstrates failure")] + public void PopulatesAppSearchTablesFromRegistrySearch() + { + var folder = TestData.Get(@"TestData"); + + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var intermediateFolder = Path.Combine(baseFolder, "obj"); + var msiPath = Path.Combine(baseFolder, @"bin\test.msi"); + + var result = WixRunner.Execute(new[] + { + "build", + Path.Combine(folder, "AppSearch", "RegistrySearch.wxs"), + Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), + Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), + "-bindpath", Path.Combine(folder, "SingleFile", "data"), + "-intermediateFolder", intermediateFolder, + "-o", msiPath + }); + + result.AssertSuccess(); + + Assert.True(File.Exists(msiPath)); + var results = Query.QueryDatabase(msiPath, new[] { "AppSearch", "RegLocator" }); + Assert.Equal(new[] + { + "AppSearch:SAMPLEREGFOUND\tSampleRegSearch", + "RegLocator:SampleRegSearch\t2\tSampleReg\t\t2", + }, results); + } + } + [Fact(Skip = "Test demonstrates failure")] public void PopulatesDirectoryTableWithValidDefaultDir() { diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/AppSearch/ComponentSearch.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/AppSearch/ComponentSearch.wxs new file mode 100644 index 00000000..4dd701f0 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/AppSearch/ComponentSearch.wxs @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/AppSearch/DirectorySearch.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/AppSearch/DirectorySearch.wxs new file mode 100644 index 00000000..e255c83d --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/AppSearch/DirectorySearch.wxs @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/AppSearch/FileSearch.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/AppSearch/FileSearch.wxs new file mode 100644 index 00000000..c17d9848 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/AppSearch/FileSearch.wxs @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/AppSearch/RegistrySearch.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/AppSearch/RegistrySearch.wxs new file mode 100644 index 00000000..f800264d --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/AppSearch/RegistrySearch.wxs @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj index e4da8b14..16f200c3 100644 --- a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj +++ b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj @@ -13,6 +13,10 @@ + + + + -- cgit v1.2.3-55-g6feb