1 // *********************************************************************
2 // Copyright 2007, Andreas Schlapsi
3 // This is free software licensed under the MIT license.
4 // *********************************************************************
6 using System
.Reflection
;
9 namespace NUnit
.Core
.Extensions
.RowTest
11 public sealed class RowTestFramework
13 public const string RowTestAttribute
= "NUnit.Framework.Extensions.RowTestAttribute";
14 public const string RowAttribute
= "NUnit.Framework.Extensions.RowAttribute";
15 public const string SpecialValueEnum
= "NUnit.Framework.Extensions.SpecialValue";
17 private RowTestFramework()
21 public static bool IsRowTest(MethodInfo method
)
26 return Reflect
.HasAttribute(method
, RowTestAttribute
, false);;
29 public static Attribute
[] GetRowAttributes(MethodInfo method
)
32 throw new ArgumentNullException("method");
34 return Reflect
.GetAttributes(method
, RowAttribute
, false);
37 public static object[] GetRowArguments(Attribute attribute
)
39 return Reflect
.GetPropertyValue(attribute
, "Arguments") as object[];
42 public static bool IsSpecialValue(object argument
)
47 return argument
.GetType().FullName
== SpecialValueEnum
;
50 public static Type
GetExpectedExceptionType(Attribute attribute
)
52 return Reflect
.GetPropertyValue(attribute
, "ExpectedException") as Type
;
55 public static string GetExpectedExceptionMessage(Attribute attribute
)
57 return Reflect
.GetPropertyValue(attribute
, "ExceptionMessage") as string;
60 public static string GetTestName(Attribute attribute
)
62 return Reflect
.GetPropertyValue(attribute
, "TestName") as string;