From caa1cb214560a7faf756ae35aed82e36beab1ded Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20El-Saig?= Date: Fri, 9 Jun 2023 18:28:28 +0200 Subject: [PATCH 1/7] Replace RestEase reference to Refit. --- .../Extensions/ShortcutsUITestContextExtensions.cs | 5 ++--- Lombiq.Tests.UI/Lombiq.Tests.UI.csproj | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Lombiq.Tests.UI/Extensions/ShortcutsUITestContextExtensions.cs b/Lombiq.Tests.UI/Extensions/ShortcutsUITestContextExtensions.cs index 602bf672f..aa55477cd 100644 --- a/Lombiq.Tests.UI/Extensions/ShortcutsUITestContextExtensions.cs +++ b/Lombiq.Tests.UI/Extensions/ShortcutsUITestContextExtensions.cs @@ -1,4 +1,3 @@ -using Atata; using Lombiq.HelpfulLibraries.OrchardCore.Mvc; using Lombiq.Tests.UI.Constants; using Lombiq.Tests.UI.Exceptions; @@ -32,7 +31,7 @@ using OrchardCore.Workflows.Http.Models; using OrchardCore.Workflows.Models; using OrchardCore.Workflows.Services; -using RestEase; +using Refit; using Shouldly; using System; using System.Collections.Concurrent; @@ -414,7 +413,7 @@ private static IShortcutsApi GetApi(this UITestContext context) => BaseAddress = context.Scope.BaseUri, }; - return RestClient.For(httpClient); + return RestService.For(httpClient); }); [SuppressMessage( diff --git a/Lombiq.Tests.UI/Lombiq.Tests.UI.csproj b/Lombiq.Tests.UI/Lombiq.Tests.UI.csproj index 7c7661297..45eaebb08 100644 --- a/Lombiq.Tests.UI/Lombiq.Tests.UI.csproj +++ b/Lombiq.Tests.UI/Lombiq.Tests.UI.csproj @@ -66,6 +66,7 @@ + @@ -82,7 +83,6 @@ - @@ -92,7 +92,6 @@ - From 96166d6aeb89a6b83aac46fa080e04596a8611ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20El-Saig?= Date: Fri, 9 Jun 2023 21:42:27 +0200 Subject: [PATCH 2/7] Fix missing leading slash in API URLs. --- Lombiq.Tests.UI/Extensions/ShortcutsUITestContextExtensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lombiq.Tests.UI/Extensions/ShortcutsUITestContextExtensions.cs b/Lombiq.Tests.UI/Extensions/ShortcutsUITestContextExtensions.cs index aa55477cd..7fe686e19 100644 --- a/Lombiq.Tests.UI/Extensions/ShortcutsUITestContextExtensions.cs +++ b/Lombiq.Tests.UI/Extensions/ShortcutsUITestContextExtensions.cs @@ -422,7 +422,7 @@ private static IShortcutsApi GetApi(this UITestContext context) => Justification = "Just maps to controller actions.")] public interface IShortcutsApi { - [Get("api/ApplicationInfo")] + [Get("/api/ApplicationInfo")] Task GetApplicationInfoFromApiAsync(); } From ea7975708c47b4dc43b2713cd34d60643bd0db24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20El-Saig?= Date: Fri, 9 Jun 2023 21:48:28 +0200 Subject: [PATCH 3/7] Add missing documentation. --- .../Extensions/ShortcutsUITestContextExtensions.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Lombiq.Tests.UI/Extensions/ShortcutsUITestContextExtensions.cs b/Lombiq.Tests.UI/Extensions/ShortcutsUITestContextExtensions.cs index 7fe686e19..a199501e4 100644 --- a/Lombiq.Tests.UI/Extensions/ShortcutsUITestContextExtensions.cs +++ b/Lombiq.Tests.UI/Extensions/ShortcutsUITestContextExtensions.cs @@ -416,12 +416,14 @@ private static IShortcutsApi GetApi(this UITestContext context) => return RestService.For(httpClient); }); - [SuppressMessage( - "StyleCop.CSharp.DocumentationRules", - "SA1600:Elements should be documented", - Justification = "Just maps to controller actions.")] + /// + /// A client interface for Lombiq.Tests.UI.Shortcuts web APIs. + /// public interface IShortcutsApi { + /// + /// Sends a web request to endpoint. + /// [Get("/api/ApplicationInfo")] Task GetApplicationInfoFromApiAsync(); } From c3816805fb436676f730dd79a541213476806618 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20El-Saig?= Date: Fri, 9 Jun 2023 21:57:11 +0200 Subject: [PATCH 4/7] unusing --- .../Extensions/ShortcutsUITestContextExtensions.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lombiq.Tests.UI/Extensions/ShortcutsUITestContextExtensions.cs b/Lombiq.Tests.UI/Extensions/ShortcutsUITestContextExtensions.cs index a199501e4..4459969a3 100644 --- a/Lombiq.Tests.UI/Extensions/ShortcutsUITestContextExtensions.cs +++ b/Lombiq.Tests.UI/Extensions/ShortcutsUITestContextExtensions.cs @@ -11,6 +11,7 @@ using OpenQA.Selenium; using OrchardCore.Abstractions.Setup; using OrchardCore.Admin; +using OrchardCore.Data; using OrchardCore.DisplayManagement.Extensions; using OrchardCore.Entities; using OrchardCore.Environment.Extensions; @@ -36,7 +37,6 @@ using System; using System.Collections.Concurrent; using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; using System.Net.Http; @@ -479,7 +479,7 @@ public static async Task CreateAndSwitchToTenantAsync( { setupParameters ??= new OrchardCoreSetupParameters(context); var databaseProvider = setupParameters.DatabaseProvider == OrchardCoreSetupPage.DatabaseType.SqlServer - ? OrchardCore.Data.DatabaseProviderValue.SqlConnection + ? DatabaseProviderValue.SqlConnection : setupParameters.DatabaseProvider.ToString(); await context.Application.UsingScopeAsync( From 54e605ee1274c982672f3a74f0c607695bfde220 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20El-Saig?= Date: Sat, 10 Jun 2023 07:44:16 +0200 Subject: [PATCH 5/7] Use RefitHelper.WithNewtonsoft. --- Lombiq.Tests.UI/Extensions/ShortcutsUITestContextExtensions.cs | 3 ++- Lombiq.Tests.UI/Lombiq.Tests.UI.csproj | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Lombiq.Tests.UI/Extensions/ShortcutsUITestContextExtensions.cs b/Lombiq.Tests.UI/Extensions/ShortcutsUITestContextExtensions.cs index 4459969a3..49cbd93ef 100644 --- a/Lombiq.Tests.UI/Extensions/ShortcutsUITestContextExtensions.cs +++ b/Lombiq.Tests.UI/Extensions/ShortcutsUITestContextExtensions.cs @@ -1,4 +1,5 @@ using Lombiq.HelpfulLibraries.OrchardCore.Mvc; +using Lombiq.HelpfulLibraries.Refit.Helpers; using Lombiq.Tests.UI.Constants; using Lombiq.Tests.UI.Exceptions; using Lombiq.Tests.UI.Pages; @@ -413,7 +414,7 @@ private static IShortcutsApi GetApi(this UITestContext context) => BaseAddress = context.Scope.BaseUri, }; - return RestService.For(httpClient); + return RefitHelper.WithNewtonsoft(httpClient); }); /// diff --git a/Lombiq.Tests.UI/Lombiq.Tests.UI.csproj b/Lombiq.Tests.UI/Lombiq.Tests.UI.csproj index 45eaebb08..aaae98a3a 100644 --- a/Lombiq.Tests.UI/Lombiq.Tests.UI.csproj +++ b/Lombiq.Tests.UI/Lombiq.Tests.UI.csproj @@ -83,6 +83,7 @@ + @@ -92,6 +93,7 @@ + From bdcfd8e5dbfad5e392aef6964a43ef4f6ca50cc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20El-Saig?= Date: Sat, 10 Jun 2023 18:25:06 +0200 Subject: [PATCH 6/7] Rename WithNewtonsoftJson. --- Lombiq.Tests.UI/Extensions/ShortcutsUITestContextExtensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lombiq.Tests.UI/Extensions/ShortcutsUITestContextExtensions.cs b/Lombiq.Tests.UI/Extensions/ShortcutsUITestContextExtensions.cs index 49cbd93ef..08dbe1731 100644 --- a/Lombiq.Tests.UI/Extensions/ShortcutsUITestContextExtensions.cs +++ b/Lombiq.Tests.UI/Extensions/ShortcutsUITestContextExtensions.cs @@ -414,7 +414,7 @@ private static IShortcutsApi GetApi(this UITestContext context) => BaseAddress = context.Scope.BaseUri, }; - return RefitHelper.WithNewtonsoft(httpClient); + return RefitHelper.WithNewtonsoftJson(httpClient); }); /// From c68608fc3aaacf405957268e91632dfffee4802a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20El-Saig?= Date: Sat, 10 Jun 2023 19:27:12 +0200 Subject: [PATCH 7/7] Use HL alpha. --- Lombiq.Tests.UI/Lombiq.Tests.UI.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lombiq.Tests.UI/Lombiq.Tests.UI.csproj b/Lombiq.Tests.UI/Lombiq.Tests.UI.csproj index aaae98a3a..3ce48884e 100644 --- a/Lombiq.Tests.UI/Lombiq.Tests.UI.csproj +++ b/Lombiq.Tests.UI/Lombiq.Tests.UI.csproj @@ -93,7 +93,7 @@ - +