From bbc0caa2cb3f5ccad96c5e5c5a85f266ef6e61e3 Mon Sep 17 00:00:00 2001 From: Shutong Wu <51266340+Scriptwonder@users.noreply.github.com> Date: Sat, 5 Sep 2026 17:14:50 -0400 Subject: [PATCH] test(setup): look up UpdateDependencyStatus as static too #1383 made MCPSetupWindow.UpdateDependencyStatus internal static so the new GitDetectionTests could drive it directly. The characterization test still looked it up with BindingFlags.NonPublic | Instance, which no longer matches, so GetMethod returned null and the fixture failed on the Assert.IsNotNull guard rather than on the behaviour it exists to describe. beta has been red on it since 9d93c42c. Adding Static alongside Instance keeps the lookup working whichever way the method is declared. The test is a characterization test - it records that the window drives "valid"/"invalid" class lists, which is still exactly what the method does. Not caught before merging because #1383 came from a fork, where the Unity test legs report Skipped, and the pre-merge run was filtered to GitDetectionTests. Measured on 2021.3.45f2: full EditMode 1243 total, 1163 passed, 0 failed, 80 skipped; WindowsCharacterizationTests 31/31. --- .../Windows/Characterization/Windows_Characterization.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/TestProjects/UnityMCPTests/Assets/Tests/EditMode/Windows/Characterization/Windows_Characterization.cs b/TestProjects/UnityMCPTests/Assets/Tests/EditMode/Windows/Characterization/Windows_Characterization.cs index 06628db72..801b8bc3a 100644 --- a/TestProjects/UnityMCPTests/Assets/Tests/EditMode/Windows/Characterization/Windows_Characterization.cs +++ b/TestProjects/UnityMCPTests/Assets/Tests/EditMode/Windows/Characterization/Windows_Characterization.cs @@ -135,7 +135,11 @@ public void MCPSetupWindow_CachesMultipleUIElements_InCreateGUI() public void MCPSetupWindow_ModifiesClassListForStatus_ValidInvalidPattern() { var type = typeof(MCPSetupWindow); - var method = type.GetMethod("UpdateDependencyStatus", BindingFlags.NonPublic | BindingFlags.Instance); + // Static as well as Instance: the method takes every element it touches as an argument, + // so it carries no instance state and is declared static. Looking it up with Instance + // alone returned null and failed this test rather than reporting a behaviour change. + var method = type.GetMethod("UpdateDependencyStatus", + BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance); Assert.IsNotNull(method, "Should have UpdateDependencyStatus method");