aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBob Arnson <bob@firegiant.com>2020-10-22 19:35:52 -0400
committerBob Arnson <bob@firegiant.com>2020-10-22 19:35:52 -0400
commitc98e207fdaa1fd5373301abc2d50274b464e5378 (patch)
treec2cc9f58d5737f0d74895834e865b8f2c29095ef /src
parentc0bdce5ec33d97eb4820dd1c855db89a69d4c9fa (diff)
downloadwix-c98e207fdaa1fd5373301abc2d50274b464e5378.tar.gz
wix-c98e207fdaa1fd5373301abc2d50274b464e5378.tar.bz2
wix-c98e207fdaa1fd5373301abc2d50274b464e5378.zip
Add _SummaryInformation support to Query.
Diffstat (limited to 'src')
-rw-r--r--src/WixBuildTools.TestSupport/DisposableFileSystem.cs11
-rw-r--r--src/WixBuildTools.TestSupport/Query.cs21
-rw-r--r--src/WixBuildTools.TestSupport/WixAssert.cs2
3 files changed, 31 insertions, 3 deletions
diff --git a/src/WixBuildTools.TestSupport/DisposableFileSystem.cs b/src/WixBuildTools.TestSupport/DisposableFileSystem.cs
index 28440f90..f096db72 100644
--- a/src/WixBuildTools.TestSupport/DisposableFileSystem.cs
+++ b/src/WixBuildTools.TestSupport/DisposableFileSystem.cs
@@ -1,4 +1,4 @@
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. 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 2
3namespace WixBuildTools.TestSupport 3namespace WixBuildTools.TestSupport
4{ 4{
@@ -12,6 +12,13 @@ namespace WixBuildTools.TestSupport
12 12
13 private List<string> CleanupPaths { get; } = new List<string>(); 13 private List<string> CleanupPaths { get; } = new List<string>();
14 14
15 public bool Keep { get; }
16
17 public DisposableFileSystem(bool keep = false)
18 {
19 this.Keep = keep;
20 }
21
15 protected string GetFile(bool create = false) 22 protected string GetFile(bool create = false)
16 { 23 {
17 var path = Path.GetTempFileName(); 24 var path = Path.GetTempFileName();
@@ -56,7 +63,7 @@ namespace WixBuildTools.TestSupport
56 return; 63 return;
57 } 64 }
58 65
59 if (disposing) 66 if (disposing && !this.Keep)
60 { 67 {
61 foreach (var path in this.CleanupPaths) 68 foreach (var path in this.CleanupPaths)
62 { 69 {
diff --git a/src/WixBuildTools.TestSupport/Query.cs b/src/WixBuildTools.TestSupport/Query.cs
index b4e6b7f9..101a8890 100644
--- a/src/WixBuildTools.TestSupport/Query.cs
+++ b/src/WixBuildTools.TestSupport/Query.cs
@@ -44,6 +44,26 @@ namespace WixBuildTools.TestSupport
44 { 44 {
45 foreach (var table in tables) 45 foreach (var table in tables)
46 { 46 {
47 if (table == "_SummaryInformation")
48 {
49 var entries = new List<string>();
50 results.Add(table, entries);
51
52 entries.Add($"Title\t{db.SummaryInfo.Title}");
53 entries.Add($"Subject\t{db.SummaryInfo.Subject}");
54 entries.Add($"Author\t{db.SummaryInfo.Author}");
55 entries.Add($"Keywords\t{db.SummaryInfo.Keywords}");
56 entries.Add($"Comments\t{db.SummaryInfo.Comments}");
57 entries.Add($"Template\t{db.SummaryInfo.Template}");
58 entries.Add($"CodePage\t{db.SummaryInfo.CodePage}");
59 entries.Add($"PageCount\t{db.SummaryInfo.PageCount}");
60 entries.Add($"WordCount\t{db.SummaryInfo.WordCount}");
61 entries.Add($"CharacterCount\t{db.SummaryInfo.CharacterCount}");
62 entries.Add($"Security\t{db.SummaryInfo.Security}");
63
64 continue;
65 }
66
47 if (!db.IsTablePersistent(table)) 67 if (!db.IsTablePersistent(table))
48 { 68 {
49 results.Add(table, null); 69 results.Add(table, null);
@@ -52,6 +72,7 @@ namespace WixBuildTools.TestSupport
52 72
53 var rows = new List<string>(); 73 var rows = new List<string>();
54 results.Add(table, rows); 74 results.Add(table, rows);
75
55 using (var view = db.OpenView("SELECT * FROM `{0}`", table)) 76 using (var view = db.OpenView("SELECT * FROM `{0}`", table))
56 { 77 {
57 view.Execute(); 78 view.Execute();
diff --git a/src/WixBuildTools.TestSupport/WixAssert.cs b/src/WixBuildTools.TestSupport/WixAssert.cs
index 0882e26e..5638a787 100644
--- a/src/WixBuildTools.TestSupport/WixAssert.cs
+++ b/src/WixBuildTools.TestSupport/WixAssert.cs
@@ -22,8 +22,8 @@ namespace WixBuildTools.TestSupport
22 22
23 public static void CompareXml(XContainer xExpected, XContainer xActual) 23 public static void CompareXml(XContainer xExpected, XContainer xActual)
24 { 24 {
25 var actuals = xActual.Descendants().Select(x => $"{x.Name.LocalName}:{String.Join(",", x.Attributes().OrderBy(a => a.Name.LocalName).Select(a => $"{a.Name.LocalName}={a.Value}"))}");
26 var expecteds = xExpected.Descendants().Select(x => $"{x.Name.LocalName}:{String.Join(",", x.Attributes().OrderBy(a => a.Name.LocalName).Select(a => $"{a.Name.LocalName}={a.Value}"))}"); 25 var expecteds = xExpected.Descendants().Select(x => $"{x.Name.LocalName}:{String.Join(",", x.Attributes().OrderBy(a => a.Name.LocalName).Select(a => $"{a.Name.LocalName}={a.Value}"))}");
26 var actuals = xActual.Descendants().Select(x => $"{x.Name.LocalName}:{String.Join(",", x.Attributes().OrderBy(a => a.Name.LocalName).Select(a => $"{a.Name.LocalName}={a.Value}"))}");
27 27
28 CompareLineByLine(expecteds.OrderBy(s => s).ToArray(), actuals.OrderBy(s => s).ToArray()); 28 CompareLineByLine(expecteds.OrderBy(s => s).ToArray(), actuals.OrderBy(s => s).ToArray());
29 } 29 }