From 7c5c95f2325398a84b65246dc9023a891cc555b5 Mon Sep 17 00:00:00 2001 From: katie-gardner-AND Date: Mon, 9 Dec 2024 13:44:31 +0000 Subject: [PATCH] fix: Fix sonar cloud errors --- src/Dfe.PlanTech.Web/Controllers/PagesController.cs | 4 +--- .../Controllers/PagesControllerTests.cs | 3 +-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/Dfe.PlanTech.Web/Controllers/PagesController.cs b/src/Dfe.PlanTech.Web/Controllers/PagesController.cs index 0f15be1b0..390d0f9c7 100644 --- a/src/Dfe.PlanTech.Web/Controllers/PagesController.cs +++ b/src/Dfe.PlanTech.Web/Controllers/PagesController.cs @@ -18,13 +18,11 @@ namespace Dfe.PlanTech.Web.Controllers; [Route("/")] public class PagesController( ILogger logger, - IGetPageQuery getPageQuery, IGetNavigationQuery getNavigationQuery, IOptions contactOptions, IOptions errorPages) : BaseController(logger) { private readonly ContactOptions _contactOptions = contactOptions.Value; - private readonly ErrorPages _errorPages = errorPages.Value; public const string ControllerName = "Pages"; public const string GetPageByRouteAction = nameof(GetByRoute); public const string NotFoundPage = "NotFoundError"; @@ -66,7 +64,7 @@ public async Task NotFoundError() return View(viewModel); } - private async Task GetContactLinkAsync() + private async Task GetContactLinkAsync() { return await getNavigationQuery.GetLinkById(_contactOptions.LinkId); } diff --git a/tests/Dfe.PlanTech.Web.UnitTests/Controllers/PagesControllerTests.cs b/tests/Dfe.PlanTech.Web.UnitTests/Controllers/PagesControllerTests.cs index f54f0fe8b..ca1b8f1c3 100644 --- a/tests/Dfe.PlanTech.Web.UnitTests/Controllers/PagesControllerTests.cs +++ b/tests/Dfe.PlanTech.Web.UnitTests/Controllers/PagesControllerTests.cs @@ -28,7 +28,6 @@ public class PagesControllerTests readonly ICookieService cookiesSubstitute = Substitute.For(); readonly IUser userSubstitute = Substitute.For(); private readonly IGetNavigationQuery _getNavigationQuery = Substitute.For(); - private readonly IGetPageQuery _getPageQuery = Substitute.For(); private readonly PagesController _controller; private readonly ControllerContext _controllerContext; private readonly IOptions _contactOptions; @@ -48,7 +47,7 @@ public PagesControllerTests() _contactOptions = Options.Create(contactUs); _errorPages = Options.Create(new ErrorPages { InternalErrorPageId = INTERNAL_ERROR_ID }); - _controller = new PagesController(Logger, _getPageQuery, _getNavigationQuery, _contactOptions, _errorPages) + _controller = new PagesController(Logger, _getNavigationQuery, _contactOptions, _errorPages) { ControllerContext = _controllerContext, TempData = Substitute.For()