How to generate NUnit fixtures programmatically?
Say I have a test like:
void TestSomething(int someParam)
{
// Test code
}
I would like to execute this test with a set of "someParam" values. I could write explicit [Test] fixtures calling TestSomething() with the parameters, which means having N methods for every TestSomething() method. I could write another [Test] method looping on "someParam" values and calling TestSomething(), it means 2 methods for every test, and the test report is not as good as with individual TestSomethingWithXValue() met开发者_StackOverflow中文版hods.
So, is there any way to programmatically generate fixtures for every test methods and input values?
Check out Parameterized Tests With NUnit 2.5.
精彩评论