From f49a3027be208f628e99550328d22a1c3c2a7499 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Sat, 21 Dec 2024 23:34:03 +0100 Subject: [PATCH 1/6] Migrating test project to xUnit v3 --- .../Lombiq.HelpfulLibraries.Tests.csproj | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Lombiq.HelpfulLibraries.Tests/Lombiq.HelpfulLibraries.Tests.csproj b/Lombiq.HelpfulLibraries.Tests/Lombiq.HelpfulLibraries.Tests.csproj index 834c188c..d6c47f9e 100644 --- a/Lombiq.HelpfulLibraries.Tests/Lombiq.HelpfulLibraries.Tests.csproj +++ b/Lombiq.HelpfulLibraries.Tests/Lombiq.HelpfulLibraries.Tests.csproj @@ -2,6 +2,7 @@ net8.0 + Exe @@ -16,8 +17,9 @@ - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive From a57a14c1d74e8f353fb348bd031743e62df1a1d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Wed, 25 Dec 2024 03:36:27 +0100 Subject: [PATCH 2/6] Analyzer violations --- .../Mvc/FromJsonQueryStringAttribute.cs | 2 ++ .../Contents/JsonSectionDisplayDriver.cs | 4 ++-- Lombiq.HelpfulLibraries.OrchardCore/Users/PasswordHelper.cs | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Lombiq.HelpfulLibraries.AspNetCore/Mvc/FromJsonQueryStringAttribute.cs b/Lombiq.HelpfulLibraries.AspNetCore/Mvc/FromJsonQueryStringAttribute.cs index 11893a7e..a139712a 100644 --- a/Lombiq.HelpfulLibraries.AspNetCore/Mvc/FromJsonQueryStringAttribute.cs +++ b/Lombiq.HelpfulLibraries.AspNetCore/Mvc/FromJsonQueryStringAttribute.cs @@ -1,8 +1,10 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.ModelBinding; +using System; namespace Lombiq.HelpfulLibraries.AspNetCore.Mvc; +[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = true)] public sealed class FromJsonQueryStringAttribute : ModelBinderAttribute { public FromJsonQueryStringAttribute() diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Contents/JsonSectionDisplayDriver.cs b/Lombiq.HelpfulLibraries.OrchardCore/Contents/JsonSectionDisplayDriver.cs index de76aa66..133badad 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Contents/JsonSectionDisplayDriver.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/Contents/JsonSectionDisplayDriver.cs @@ -1,4 +1,4 @@ -using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc.ModelBinding; using OrchardCore.DisplayManagement.Entities; @@ -33,7 +33,7 @@ protected JsonSectionDisplayDriver( _hca = hca; } - public async override Task EditAsync(ISite model, TSection section, BuildEditorContext context) => + public override async Task EditAsync(ISite model, TSection section, BuildEditorContext context) => await AuthorizeAsync() ? Initialize>( ShapeType, diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Users/PasswordHelper.cs b/Lombiq.HelpfulLibraries.OrchardCore/Users/PasswordHelper.cs index a8fafe40..5fcd50de 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Users/PasswordHelper.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/Users/PasswordHelper.cs @@ -33,7 +33,7 @@ public static string GenerateRandomPassword(int minLength) } passwordChars = [.. passwordChars.OrderBy(c => rng.Next(0, int.MaxValue))]; - string password = new(passwordChars.ToArray()); + string password = new([.. passwordChars]); return password; } From 686a7ff9d938ce614074326b4077efe085c6009b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Wed, 25 Dec 2024 04:31:16 +0100 Subject: [PATCH 3/6] Fixing more analyzer violations --- .../TagHelpers/EditorFieldSetTagHelper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lombiq.HelpfulLibraries.OrchardCore/TagHelpers/EditorFieldSetTagHelper.cs b/Lombiq.HelpfulLibraries.OrchardCore/TagHelpers/EditorFieldSetTagHelper.cs index baf8857c..1c2d71b1 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/TagHelpers/EditorFieldSetTagHelper.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/TagHelpers/EditorFieldSetTagHelper.cs @@ -168,7 +168,7 @@ private static bool HasRequiredAttribute(ModelExpression modelExpression) => .GetCustomAttributes(typeof(RequiredAttribute), inherit: false) .FirstOrDefault() is RequiredAttribute; - private static void AddBoolAttribute(IDictionary attributes, bool value, string attributeName) + private static void AddBoolAttribute(Dictionary attributes, bool value, string attributeName) { if (value) { From dbadbffe419fe7ff0bbb5f0c6d5ba4b8a477bbad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Sun, 29 Dec 2024 05:31:38 +0100 Subject: [PATCH 4/6] Adding ExecuteUntilOutputAsync --- .../Extensions/CommandExtensions.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Lombiq.HelpfulLibraries.Cli/Extensions/CommandExtensions.cs b/Lombiq.HelpfulLibraries.Cli/Extensions/CommandExtensions.cs index d103876e..24b95e59 100644 --- a/Lombiq.HelpfulLibraries.Cli/Extensions/CommandExtensions.cs +++ b/Lombiq.HelpfulLibraries.Cli/Extensions/CommandExtensions.cs @@ -16,17 +16,26 @@ public static class CommandExtensions /// Executes a as a dotnet command that starts a long-running application, and waits /// for the app to be started. /// - public static async Task ExecuteDotNetApplicationAsync( + public static Task ExecuteDotNetApplicationAsync( this Command command, Action? stdErrHandler = default, + CancellationToken cancellationToken = default) => + command.ExecuteUntilOutputAsync("Application started. Press Ctrl+C to shut down.", stdErrHandler, cancellationToken); + + /// + /// Executes a until the given output is received, then returns. + /// + public static async Task ExecuteUntilOutputAsync( + this Command command, + string outputToWaitFor, + Action? stdErrHandler = default, CancellationToken cancellationToken = default) { await using var enumerator = command.ListenAsync(cancellationToken).GetAsyncEnumerator(cancellationToken); while (await enumerator.MoveNextAsync()) { - if (enumerator.Current is StandardOutputCommandEvent stdOut && - stdOut.Text.ContainsOrdinalIgnoreCase("Application started. Press Ctrl+C to shut down.")) + if (enumerator.Current is StandardOutputCommandEvent stdOut && stdOut.Text.ContainsOrdinalIgnoreCase(outputToWaitFor)) { return; } From 83c06ba67a5f0a627dc311ccf44827935d37c32a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Tue, 31 Dec 2024 18:06:09 +0100 Subject: [PATCH 5/6] Downgrading testing packages until Renovate can take over --- .../Lombiq.HelpfulLibraries.Tests.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lombiq.HelpfulLibraries.Tests/Lombiq.HelpfulLibraries.Tests.csproj b/Lombiq.HelpfulLibraries.Tests/Lombiq.HelpfulLibraries.Tests.csproj index d6c47f9e..e5b7d76b 100644 --- a/Lombiq.HelpfulLibraries.Tests/Lombiq.HelpfulLibraries.Tests.csproj +++ b/Lombiq.HelpfulLibraries.Tests/Lombiq.HelpfulLibraries.Tests.csproj @@ -17,9 +17,9 @@ - + - + all runtime; build; native; contentfiles; analyzers; buildtransitive From fbd4443eb727a63f02e51ad0afa0a2dc101ffc04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Tue, 31 Dec 2024 18:35:58 +0100 Subject: [PATCH 6/6] Removing the rest of the xUnit v3 pieces --- .../Lombiq.HelpfulLibraries.Tests.csproj | 2 -- 1 file changed, 2 deletions(-) diff --git a/Lombiq.HelpfulLibraries.Tests/Lombiq.HelpfulLibraries.Tests.csproj b/Lombiq.HelpfulLibraries.Tests/Lombiq.HelpfulLibraries.Tests.csproj index e5b7d76b..834c188c 100644 --- a/Lombiq.HelpfulLibraries.Tests/Lombiq.HelpfulLibraries.Tests.csproj +++ b/Lombiq.HelpfulLibraries.Tests/Lombiq.HelpfulLibraries.Tests.csproj @@ -2,7 +2,6 @@ net8.0 - Exe @@ -18,7 +17,6 @@ - all runtime; build; native; contentfiles; analyzers; buildtransitive