From bcdb90a63e03143656d41655243c324837288631 Mon Sep 17 00:00:00 2001 From: Szabolcs Deme Date: Tue, 16 May 2023 18:30:42 +0200 Subject: [PATCH 1/3] Moving DebugHelper and TestOutputHelperExtensions to Lombiq.Tests --- .../Extensions/TestOutputHelperExtensions.cs | 20 ------------------ Lombiq.Tests.UI/Helpers/DebugHelper.cs | 21 ------------------- 2 files changed, 41 deletions(-) delete mode 100644 Lombiq.Tests.UI/Extensions/TestOutputHelperExtensions.cs delete mode 100644 Lombiq.Tests.UI/Helpers/DebugHelper.cs diff --git a/Lombiq.Tests.UI/Extensions/TestOutputHelperExtensions.cs b/Lombiq.Tests.UI/Extensions/TestOutputHelperExtensions.cs deleted file mode 100644 index e35412e5b..000000000 --- a/Lombiq.Tests.UI/Extensions/TestOutputHelperExtensions.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Lombiq.Tests.UI.Helpers; - -namespace Xunit.Abstractions; - -public static class TestOutputHelperExtensions -{ - public static void WriteLineTimestampedAndDebug(this ITestOutputHelper testOutputHelper, string format, params object[] args) - { - testOutputHelper.WriteLineTimestamped(format, args); - DebugHelper.WriteLineTimestamped(format, args); - } - - public static void WriteLineTimestamped(this ITestOutputHelper testOutputHelper, string format, params object[] args) - { - // Preventing "FormatException : Input string was not in a correct format." exceptions if the message contains - // characters used in string formatting but it shouldn't actually be formatted. - if (args == null || args.Length == 0) testOutputHelper.WriteLine(DebugHelper.PrefixWithTimestamp(format)); - else testOutputHelper.WriteLine(DebugHelper.PrefixWithTimestamp(format), args); - } -} diff --git a/Lombiq.Tests.UI/Helpers/DebugHelper.cs b/Lombiq.Tests.UI/Helpers/DebugHelper.cs deleted file mode 100644 index 95f89940f..000000000 --- a/Lombiq.Tests.UI/Helpers/DebugHelper.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using System.Diagnostics; -using System.Globalization; - -namespace Lombiq.Tests.UI.Helpers; - -public static class DebugHelper -{ - public static void WriteLineTimestamped(string format, params object[] args) - { - // Preventing "FormatException : Input string was not in a correct format." exceptions if the message contains - // characters used in string formatting but it shouldn't actually be formatted. - if (args == null || args.Length == 0) Debug.WriteLine(PrefixWithTimestamp(format)); - else Debug.WriteLine(PrefixWithTimestamp(format), args); - } - - // Note that this uses UTC, while Atata's log uses the local time zone: - // https://github.com/atata-framework/atata/issues/483. - public static string PrefixWithTimestamp(string message) => - $"{DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss.ffff", CultureInfo.InvariantCulture)} - {message}"; -} From 5d8690642564cb9ef67d39ce55548871b9390375 Mon Sep 17 00:00:00 2001 From: Szabolcs Deme Date: Tue, 16 May 2023 18:41:13 +0200 Subject: [PATCH 2/3] Correcting changed namespaces --- Lombiq.Tests.UI/Services/SqlServerManager.cs | 2 +- .../Services/SynchronizingWebApplicationSnapshotManager.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Lombiq.Tests.UI/Services/SqlServerManager.cs b/Lombiq.Tests.UI/Services/SqlServerManager.cs index 3ee2460b7..57cb7fd5b 100644 --- a/Lombiq.Tests.UI/Services/SqlServerManager.cs +++ b/Lombiq.Tests.UI/Services/SqlServerManager.cs @@ -1,8 +1,8 @@ using CliWrap; using Lombiq.HelpfulLibraries.Cli; using Lombiq.HelpfulLibraries.Common.Utilities; +using Lombiq.Tests.Helpers; using Lombiq.Tests.UI.Exceptions; -using Lombiq.Tests.UI.Helpers; using Microsoft.Data.SqlClient; using Microsoft.IdentityModel.Tokens; using Microsoft.SqlServer.Management.Common; diff --git a/Lombiq.Tests.UI/Services/SynchronizingWebApplicationSnapshotManager.cs b/Lombiq.Tests.UI/Services/SynchronizingWebApplicationSnapshotManager.cs index a15d8bbe2..55f0e2b64 100644 --- a/Lombiq.Tests.UI/Services/SynchronizingWebApplicationSnapshotManager.cs +++ b/Lombiq.Tests.UI/Services/SynchronizingWebApplicationSnapshotManager.cs @@ -1,4 +1,4 @@ -using Lombiq.Tests.UI.Helpers; +using Lombiq.Tests.Helpers; using System; using System.Diagnostics.CodeAnalysis; using System.Threading; From 41509369773737cb1bddf8b9e80d4ef1b7c5b77a Mon Sep 17 00:00:00 2001 From: Szabolcs Deme Date: Tue, 16 May 2023 18:49:53 +0200 Subject: [PATCH 3/3] Adding back UI.Helpers namespace to SynchronizingWebApplicationSnapshotManager since it's used --- .../Services/SynchronizingWebApplicationSnapshotManager.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Lombiq.Tests.UI/Services/SynchronizingWebApplicationSnapshotManager.cs b/Lombiq.Tests.UI/Services/SynchronizingWebApplicationSnapshotManager.cs index 55f0e2b64..2fd838782 100644 --- a/Lombiq.Tests.UI/Services/SynchronizingWebApplicationSnapshotManager.cs +++ b/Lombiq.Tests.UI/Services/SynchronizingWebApplicationSnapshotManager.cs @@ -1,4 +1,5 @@ using Lombiq.Tests.Helpers; +using Lombiq.Tests.UI.Helpers; using System; using System.Diagnostics.CodeAnalysis; using System.Threading;