Use of TestCaseAttribute versus TestFixtureAttribute
What are the uses of the NUnit TestCaseAttribute with arguments as opposed to using the 开发者_如何转开发TestFixtureAttribute with arguments ?
Let's say you have two unit tests in a single TestFixture, one test that allows parameters and one that doesn't. In that instance use the TestCase attribute to pass arguments to the test case needing parameters.
On the other hand, say you have several different tests that might need the same collection of parameters. Instead of putting the same set of TestCase attributes on top of every test in the fixture, use a parameterized TestFixture.
(Incidentally, I didn't realize NUnit had this particular feature until I read your question.)
精彩评论