You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Generic class row that infers no type argument: core rule for method [Arguments] rows and constructor binding, both modes #7389
Split from #7337, which went over the issue-pr-loop rework budget (20 automated review rounds, with a blocking finding still open). This part delivers the core behaviour of #7209 for class [Arguments] rows beside method [Arguments] rows only.
Scope
A class-level [Arguments] row whose values bind only to constructor parameters that don't use a class type parameter (for example [Arguments(42)] on C<T>(int number)) supplies no class type argument. In both modes:
Each instance is built from the class row (number = 42).
The class row binds to the same constructor in both modes: the [TestConstructor] constructor when there is one, otherwise the first public instance constructor (this includes C# primary constructors).
Files
TUnit.Core.SourceGenerator/Generators/TestMetadataGenerator.cs: ClassRowSuppliesNoTypeArguments and GetClassRowConstructor, plus replacing the NoClassRowForMethodRowMessage throw with the type-free rows used as class rows.
TUnit.Engine/Discovery/ReflectionTestDataCollector.cs: SplitTypeFreeClassRows/ClassRowSuppliesNoTypeArguments/GetClassRowConstructor, limited to the class-row and method-row path.
ReflectionGenericConstraintViolations.cs: only if the method-row constraint check needs the shared type mapping.
Tests: TestProject Bugs/_7209 (the row that infers no type, the control row that does infer T, the primary-constructor and [TestConstructor] classes), Issue7209Tests in both modes, and the Tests7209 generator snapshot.
Reusable commits
Branch issue-7209-generic-class-row-no-type-arg (PR #7337). Start from fdc2edb570, 9d27913945, and the [TestConstructor] half of bc7255a35a. Leave out the commits for other data sources; they belong to the sibling issue.
Activity
fix(generic): run non-inferring method sources beside type-free class…
fix(generic): treat empty class rows as type-free and report constrai…
fix(engine): skip CancellationToken parameters when reflection checks…
test: rename the leading-token fixture so the constrained-class filte…
fix(generic): bind class rows to the [TestConstructor] or first publi…
fix(generic): run non-inferring method sources beside type-free class…
fix(generic): treat empty class rows as type-free and report constrai…
fix(engine): skip CancellationToken parameters when reflection checks…
test: rename the leading-token fixture so the constrained-class filte…
refactor(engine): use FindRowConstructor as the one reflection class-…
fix(generic): a type-free class [Arguments] row lets method rows infe…