@joebigelow / wix / commits / c98e207f

Add _SummaryInformation support to Query.

Bob Arnson committed Oct 22, 2020 at 19:35 UTC c98e207fdaa1fd5373301abc2d50274b464e5378
3 files changed +31 -3
src/WixBuildTools.TestSupport/DisposableFileSystem.cs
+9 -2
@@ -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
3 namespace WixBuildTools.TestSupport
4 {
@@ -12,6 +12,13 @@ namespace WixBuildTools.TestSupport
12
13 private List<string> CleanupPaths { get; } = new List<string>();
14
15 + public bool Keep { get; }
16 +
17 + public DisposableFileSystem(bool keep = false)
18 + {
19 + this.Keep = keep;
20 + }
21 +
22 protected string GetFile(bool create = false)
23 {
24 var path = Path.GetTempFileName();
@@ -56,7 +63,7 @@ namespace WixBuildTools.TestSupport
63 return;
64 }
65
59 - if (disposing)
66 + if (disposing && !this.Keep)
67 {
68 foreach (var path in this.CleanupPaths)
69 {
src/WixBuildTools.TestSupport/Query.cs
+21
@@ -44,6 +44,26 @@ namespace WixBuildTools.TestSupport
44 {
45 foreach (var table in tables)
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 +
67 if (!db.IsTablePersistent(table))
68 {
69 results.Add(table, null);
@@ -52,6 +72,7 @@ namespace WixBuildTools.TestSupport
72
73 var rows = new List<string>();
74 results.Add(table, rows);
75 +
76 using (var view = db.OpenView("SELECT * FROM `{0}`", table))
77 {
78 view.Execute();
src/WixBuildTools.TestSupport/WixAssert.cs
+1 -1
@@ -22,8 +22,8 @@ namespace WixBuildTools.TestSupport
22
23 public static void CompareXml(XContainer xExpected, XContainer xActual)
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}"))}");
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
28 CompareLineByLine(expecteds.OrderBy(s => s).ToArray(), actuals.OrderBy(s => s).ToArray());
29 }