From 53e58d8b1b61c44405322bf91a8aa230f02b8323 Mon Sep 17 00:00:00 2001 From: zerafachris Date: Tue, 21 Jul 2026 08:51:30 +0200 Subject: Make ItemUpdateController.UpdateItem internal instead of reflection Addresses review feedback from @Bond-009 on PR #17370: the test helper InvokeUpdateItem was invoking the private UpdateItem(BaseItemDto, BaseItem) method via reflection. Jellyfin.Api.csproj already grants InternalsVisibleTo("Jellyfin.Api.Tests"), so the method is changed to internal and the test now calls it directly, removing the GetMethod/Invoke boilerplate. Co-Authored-By: Claude Sonnet 5 --- Jellyfin.Api/Controllers/ItemUpdateController.cs | 2 +- .../Controllers/ItemUpdateControllerTests.cs | 12 +----------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/Jellyfin.Api/Controllers/ItemUpdateController.cs b/Jellyfin.Api/Controllers/ItemUpdateController.cs index b0ea1dd911..65f53a23ff 100644 --- a/Jellyfin.Api/Controllers/ItemUpdateController.cs +++ b/Jellyfin.Api/Controllers/ItemUpdateController.cs @@ -236,7 +236,7 @@ public class ItemUpdateController : BaseJellyfinApiController return NoContent(); } - private async Task UpdateItem(BaseItemDto request, BaseItem item) + internal async Task UpdateItem(BaseItemDto request, BaseItem item) { item.Name = request.Name; item.ForcedSortName = request.ForcedSortName; diff --git a/tests/Jellyfin.Api.Tests/Controllers/ItemUpdateControllerTests.cs b/tests/Jellyfin.Api.Tests/Controllers/ItemUpdateControllerTests.cs index fa167203dd..1a91efe4f2 100644 --- a/tests/Jellyfin.Api.Tests/Controllers/ItemUpdateControllerTests.cs +++ b/tests/Jellyfin.Api.Tests/Controllers/ItemUpdateControllerTests.cs @@ -1,5 +1,4 @@ using System; -using System.Reflection; using System.Threading.Tasks; using Jellyfin.Api.Controllers; using MediaBrowser.Controller.Configuration; @@ -73,15 +72,6 @@ public class ItemUpdateControllerTests private Task InvokeUpdateItem(BaseItemDto request, BaseItem item) { - var method = typeof(ItemUpdateController).GetMethod( - "UpdateItem", - BindingFlags.NonPublic | BindingFlags.Instance, - null, - new[] { typeof(BaseItemDto), typeof(BaseItem) }, - null); - - Assert.NotNull(method); - - return (Task)method!.Invoke(_subject, new object[] { request, item })!; + return _subject.UpdateItem(request, item); } } -- cgit v1.2.3