@@ -43,6 +43,7 @@ public static void Main()
4343 {
4444 // then we run the tests
4545 RunTest ( methods , typeof ( TestMethodAttribute ) ) ;
46+ RunTest ( methods , typeof ( DataRowAttribute ) ) ;
4647
4748 // last we handle Cleanup
4849 RunTest ( methods , typeof ( CleanupAttribute ) ) ;
@@ -67,21 +68,23 @@ private static bool RunTest(
6768
6869 foreach ( var attrib in attribs )
6970 {
71+ var methodName = Helper . GetTestDisplayName ( method , attrib ) ;
7072 if ( attribToRun == attrib . GetType ( ) )
7173 {
7274 try
7375 {
7476 dt = DateTime . UtcNow . Ticks ;
75- method . Invoke ( null , null ) ;
77+ object [ ] parameters = GetParameters ( attrib ) ;
78+ method . Invoke ( null , parameters ) ;
7679 totalTicks = DateTime . UtcNow . Ticks - dt ;
7780
78- Console . WriteLine ( $ "Test passed: { method . Name } , { totalTicks } ") ;
81+ Console . WriteLine ( $ "Test passed: { methodName } , { totalTicks } ") ;
7982 }
8083 catch ( Exception ex )
8184 {
8285 if ( ex . GetType ( ) == typeof ( SkipTestException ) )
8386 {
84- Console . WriteLine ( $ "Test skipped: { method . Name } , { ex . Message } ") ;
87+ Console . WriteLine ( $ "Test skipped: { methodName } , { ex . Message } ") ;
8588 if ( isSetupMethod )
8689 {
8790 // In case the Setup attribute test is skipped, we will skip
@@ -91,7 +94,7 @@ private static bool RunTest(
9194 }
9295 else
9396 {
94- Console . WriteLine ( $ "Test failed: { method . Name } , { ex . Message } ") ;
97+ Console . WriteLine ( $ "Test failed: { methodName } , { ex . Message } ") ;
9598 }
9699 }
97100
@@ -101,5 +104,16 @@ private static bool RunTest(
101104
102105 return true ;
103106 }
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+ }
104118 }
105119}
0 commit comments