I have a custom test-case runner that uses NUnit attributes. I load the test DLL using reflection and check whether a method contains the [Test] attribute like this:
method.IsDefined(typeof(TestAttribute), true)
However, this seems to return false if the test DLL and my runner refers to different versions of NUnit, e.g. the runner uses NUnit 2.6 and the test DLL uses NUnit 2.5 in the reference. Is there a way that I can do this check which returns true if the DLL version is different?
I would just check the full name of the attribute. There’s no other metadata in the attribute and it’s not like there’s some other
TestAttributearound that it would be mistaken for.If you want to be really strict about it you would have to do assembly binding redirection via the app.config file for your custom test runner.