nunit-addins

How to write a NUnit test for an NUnit add-in?

情到浓时终转凉″ 提交于 2019-12-11 12:29:34
问题 I'm working on a variation of this stack overflow answer that provides reliable cleanup of tests. How do you write unit tests for NUnit addins? Examining how NUnit self tests, I have determined: You can write tests, that pass, that verify correct behavior of NUnit for failing tests. You write unit tests against test fixtures in a separate assembly (otherwise the fixtures under test will execute with your unit tests) Use NUnit.TestUtilities.TestBuilder to create fixtures and call TestSuite.Run

How can I create a MethodInfo from an Action delegate

倖福魔咒の 提交于 2019-12-08 15:40:42
问题 I am trying to develop an NUnit addin that dynamically adds test methods to a suite from an object that contains a list of Action delegates. The problem is that NUnit appears to be leaning heavily on reflection to get the job done. Consequently, it looks like there's no simple way to add my Action s directly to the suite. I must, instead, add MethodInfo objects. This would normally work, but the Action delegates are anonymous, so I would have to build the types and methods to accomplish this.