Skip to content

Refactor: Split TestMethodInfo.cs (1113 lines) into focused partial classes#7967

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/refactor-testmethodinfo-partial-classes
Draft

Refactor: Split TestMethodInfo.cs (1113 lines) into focused partial classes#7967
Copilot wants to merge 2 commits intomainfrom
copilot/refactor-testmethodinfo-partial-classes

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 30, 2026

TestMethodInfo.cs had grown to 1113 lines, mixing concerns across constructor/properties, argument resolution, configuration reading, test execution, lifecycle management, and context setup — making it hard to navigate and review.

Split into 6 partial class files

File Lines Contents
TestMethodInfo.cs 111 Constructor, fields, properties, GetAllAttributes, GetAttributes<T>
TestMethodInfo.Arguments.cs 86 SetArguments, ResolveArguments
TestMethodInfo.Configuration.cs 90 GetTestTimeout, GetTestMethodAttribute, GetRetryAttribute, ThrowMultipleAttributesException
TestMethodInfo.Execution.cs 452 InvokeAsync, ExecuteInternalAsync, ExecuteInternalWithTimeoutAsync, GetRealException, HandleMethodException
TestMethodInfo.Lifecycle.cs 374 RunTestInitializeMethodAsync, RunTestCleanupMethodAsync, all Invoke* lifecycle methods, CaptureExecutionContextAfterFixtureIfNeeded
TestMethodInfo.Context.cs 67 SetTestContext, CreateTestClassInstance

Notes

  • Pure structural refactoring — no behavioral changes, no API changes
  • Each file carries only the using directives it actually needs
  • #pragma warning disable CA1852 propagated to all partial class files
  • TestMethodInfo.Execution.cs is 452 lines (above the 300-line guideline) because the execution pipeline methods are inherently larger than the issue estimated; further splitting would break logical cohesion

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • c50vsblobprodcus330.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet restore test/UnitTests/MSTestAdapter.PlatformServices.UnitTests/ conntrack --ctstate INVALID,NEW -j DROP (dns block)
  • jd4vsblobprodcus366.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet restore test/UnitTests/MSTestAdapter.PlatformServices.UnitTests/ conntrack --ctstate INVALID,NEW -j DROP (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI requested review from Copilot and removed request for Copilot April 30, 2026 22:52
Copilot AI linked an issue Apr 30, 2026 that may be closed by this pull request
5 tasks
Copilot AI requested review from Copilot and removed request for Copilot April 30, 2026 23:14
Copilot AI changed the title [WIP] Refactor TestMethodInfo.cs into focused partial classes Refactor: Split TestMethodInfo.cs (1113 lines) into focused partial classes Apr 30, 2026
Copilot AI requested a review from Evangelink April 30, 2026 23:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor: Split TestMethodInfo.cs (1113 lines) into focused partial classes

2 participants