Match MSTest overloads against the test data
TestExecutionContext.FindMethod returned the first method whose name matched TestContext.TestName, ignoring parameters. With overloaded test methods every case resolved to the same MethodInfo, which goes wrong two ways — both reproduced:
- Parameters dropped.
BuildVerifieronly callsSetParameterswhen the test data length matches thatMethodInfo's parameter count, so for the other overload it silently does not.Overload(int, int)with[DataRow(1, 2)]named its snapshotOverloadTests.Overload.verified.txt— no parameters at all, so every case of that overload collides on one file. - Wrong parameter names. The names handed to
InnerVerifiercome from that sameMethodInfo, so a same-arity overload is labeled with the other overload's parameter names.SameArityOverload(int number)with[DataRow(1)]named its snapshot..._text=1, borrowingtextfrom thestringoverload.
The data the test was invoked with is all there is to tell overloads apart, so candidates are now narrowed by parameter count (allowing for a params array, whose DataRow exposes raw pre-binding data) and then by the runtime types of that data. When neither narrows to a single candidate it falls back to the first match, so nothing that resolves today changes.
The non-overloaded path is unchanged: a single name match returns immediately, without allocating the candidate list.
OverloadTests covers both shapes — different arity, and same arity distinguishable only by type. Both produce wrong names on main.
Verify.MSTest.Tests passes for net11.0 and net48 (163), and Verify.MSTest builds for all seven target frameworks.