1+ using System . Runtime . CompilerServices ;
2+
13namespace TUnit . Core ;
24
35/// <summary>
@@ -20,7 +22,7 @@ internal interface ITestDataRow
2022/// <typeparam name="T">The type of the test data.</typeparam>
2123/// <param name="Data">The actual test data to be passed to the test method.</param>
2224/// <param name="DisplayName">
23- /// Optional custom display name for the test case.
25+ /// Optional custom display name for the test case. If not specified, the argument expression from <paramref name="Data"/> is used.
2426/// Supports parameter substitution using $paramName or $arg1, $arg2, etc.
2527/// </param>
2628/// <param name="Skip">
@@ -33,15 +35,15 @@ internal interface ITestDataRow
3335/// <code>
3436/// public static IEnumerable<TestDataRow<(string Username, string Password)>> GetLoginData()
3537/// {
36- /// yield return new(("admin", "secret123"), DisplayName: "Admin login");
38+ /// yield return new(("admin", "secret123")); // DisplayName '("admin", "secret123")' is inferred
3739/// yield return new(("guest", "guest"), DisplayName: "Guest login");
3840/// yield return new(("", ""), DisplayName: "Empty credentials", Skip: "Not implemented yet");
3941/// }
4042/// </code>
4143/// </example>
4244public record TestDataRow < T > (
4345 T Data ,
44- string ? DisplayName = null ,
46+ [ CallerArgumentExpression ( nameof ( Data ) ) ] string ? DisplayName = null ,
4547 string ? Skip = null ,
4648 string [ ] ? Categories = null
4749) : ITestDataRow
0 commit comments