Using C# on the .NET 4.5 Framework with Visual Studio 2015, I'm attempting to use Reflection to find NUnit tests and testcases from a provided .dll file. The problem I'm running into is that reflection query methods (such as IsDefined
and GetCustomAttributes
) require that attributes directly inherit from System.Attribute
.
In NUnit 3.2.1 (Latest stable version as of June 2016), attributes inherit from an NUnitAttribute
class, which in turn inherits from System.Attribute
. This prevents Reflection from finding marked NUnit tests. As a temporary work around, I've downgraded to NUnit 2.6.4 where attributes directly inherit from System.Attribute
. In the future, I would like to build in support for newer versions of NUnit.
Does anyone have solutions or suggestions for this issue? I've searched around, but cannot seem to find a way to make Reflection methods "realize" that System.Attribute
is further up the inheritance chain.
Aucun commentaire:
Enregistrer un commentaire