From ae96ff06cadd0141f48d88a7e9983ca81dace613 Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Fri, 14 Feb 2025 23:49:12 -0500 Subject: Convert tools\ to MSTest and traversal projects. --- src/internal/WixInternal.MSTestSupport/MsbuildUtilities.cs | 8 ++++++-- src/internal/WixInternal.MSTestSupport/WixAssert.cs | 14 +++++++++----- 2 files changed, 15 insertions(+), 7 deletions(-) (limited to 'src/internal') diff --git a/src/internal/WixInternal.MSTestSupport/MsbuildUtilities.cs b/src/internal/WixInternal.MSTestSupport/MsbuildUtilities.cs index 4776e6f1..8f3fecd9 100644 --- a/src/internal/WixInternal.MSTestSupport/MsbuildUtilities.cs +++ b/src/internal/WixInternal.MSTestSupport/MsbuildUtilities.cs @@ -16,7 +16,7 @@ namespace WixInternal.MSTestSupport public static class MsbuildUtilities { - public static MsbuildRunnerResult BuildProject(BuildSystem buildSystem, string projectPath, string[] arguments = null, string configuration = "Release", string verbosityLevel = "normal", bool suppressValidation = true) + public static MsbuildRunnerResult BuildProject(BuildSystem buildSystem, string projectPath, string[] arguments = null, string configuration = "Release", string verbosityLevel = "normal", bool suppressValidation = true, bool binlog = true) { var allArgs = new List { @@ -26,9 +26,13 @@ namespace WixInternal.MSTestSupport // Node reuse means that child msbuild processes can stay around after the build completes. // Under that scenario, the root msbuild does not reliably close its streams which causes us to hang. "-nr:false", - MsbuildUtilities.GetQuotedSwitch(buildSystem, "bl", Path.ChangeExtension(projectPath, ".binlog")) }; + if (binlog) + { + MsbuildUtilities.GetQuotedSwitch(buildSystem, "bl", Path.ChangeExtension(projectPath, ".binlog")); + } + if (arguments != null) { allArgs.AddRange(arguments); diff --git a/src/internal/WixInternal.MSTestSupport/WixAssert.cs b/src/internal/WixInternal.MSTestSupport/WixAssert.cs index 927ebee6..b4c59fa5 100644 --- a/src/internal/WixInternal.MSTestSupport/WixAssert.cs +++ b/src/internal/WixInternal.MSTestSupport/WixAssert.cs @@ -77,15 +77,19 @@ namespace WixInternal.MSTestSupport Assert.AreNotEqual(expected, actual, comparer); } - public static void Single(IEnumerable collection) + public static T Single(IEnumerable collection) { - Assert.AreEqual(1, collection.Count()); + return collection.Single(); } - public static void Single(IEnumerable collection, Func predicate) + public static T Single(IEnumerable collection, Func predicate) { - var results = collection.Where(predicate); - Assert.AreEqual(1, results.Count()); + return collection.Where(predicate).Single(); + } + + public static void All(IEnumerable collection, Func predicate) + { + Assert.IsTrue(collection.All(predicate)); } public static void Empty(IEnumerable collection) -- cgit v1.2.3-55-g6feb