@@ -43,6 +43,7 @@ public static void Main()
43
43
{
44
44
// then we run the tests
45
45
RunTest ( methods , typeof ( TestMethodAttribute ) ) ;
46
+ RunTest ( methods , typeof ( DataRowAttribute ) ) ;
46
47
47
48
// last we handle Cleanup
48
49
RunTest ( methods , typeof ( CleanupAttribute ) ) ;
@@ -67,21 +68,23 @@ private static bool RunTest(
67
68
68
69
foreach ( var attrib in attribs )
69
70
{
71
+ var methodName = Helper . GetTestDisplayName ( method , attrib ) ;
70
72
if ( attribToRun == attrib . GetType ( ) )
71
73
{
72
74
try
73
75
{
74
76
dt = DateTime . UtcNow . Ticks ;
75
- method . Invoke ( null , null ) ;
77
+ object [ ] parameters = GetParameters ( attrib ) ;
78
+ method . Invoke ( null , parameters ) ;
76
79
totalTicks = DateTime . UtcNow . Ticks - dt ;
77
80
78
- Console . WriteLine ( $ "Test passed: { method . Name } , { totalTicks } ") ;
81
+ Console . WriteLine ( $ "Test passed: { methodName } , { totalTicks } ") ;
79
82
}
80
83
catch ( Exception ex )
81
84
{
82
85
if ( ex . GetType ( ) == typeof ( SkipTestException ) )
83
86
{
84
- Console . WriteLine ( $ "Test skipped: { method . Name } , { ex . Message } ") ;
87
+ Console . WriteLine ( $ "Test skipped: { methodName } , { ex . Message } ") ;
85
88
if ( isSetupMethod )
86
89
{
87
90
// In case the Setup attribute test is skipped, we will skip
@@ -91,7 +94,7 @@ private static bool RunTest(
91
94
}
92
95
else
93
96
{
94
- Console . WriteLine ( $ "Test failed: { method . Name } , { ex . Message } ") ;
97
+ Console . WriteLine ( $ "Test failed: { methodName } , { ex . Message } ") ;
95
98
}
96
99
}
97
100
@@ -101,5 +104,16 @@ private static bool RunTest(
101
104
102
105
return true ;
103
106
}
107
+
108
+ private static object [ ] GetParameters ( object attribute )
109
+ {
110
+ if ( attribute . GetType ( ) != typeof ( DataRowAttribute ) )
111
+ {
112
+ return null ;
113
+ }
114
+
115
+ var testCaseAttribute = ( DataRowAttribute ) attribute ;
116
+ return testCaseAttribute . MethodParameters ;
117
+ }
104
118
}
105
119
}
0 commit comments