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
Class data rows wrapping a tuple in TestDataRow cannot bind to a tuple constructor parameter #7680
A class-level data source row that wraps a tuple in TestDataRow<T> cannot bind to a tuple constructor parameter: the tuple is spread into its elements, so the test fails while creating the instance. The same row works for a test method parameter. Users would expect a class row and a method row to bind the same way.
Expected: the constructor receives Tuple.Create(1) and the test passes.
Actual, source-generated mode: InvalidCastException: Unable to cast object of type 'System.Int32' to type 'System.Tuple1[System.Int32]'`.
Actual, reflection mode: ArgumentException: Object of type 'System.Int32' cannot be converted to type 'System.Tuple1[System.Int32]'`.
Observed on a generic class with an optional second parameter while working on #7599, at 263fe79, on net10.0. The non-generic form above shows the same code path but has not been run separately.
Cause
Class rows are unwrapped with DataUnwrapper.UnwrapWithMetadata (src/TUnit.Engine/Building/TestBuilder.cs:244 and :1090), which spreads tuples without looking at parameter types. Method rows use UnwrapWithTypesAndMetadata (TestBuilder.cs:339), which keeps a tuple whole when it fits the parameter.
Please make class rows use the same type-aware unwrapping as method rows.
Activity
Match CLR enum-array assignment for generic array constructor rows (#…