I had some time last week and therefore I played around with the new extensibility features of NUnit 2.4. I wanted to know, how difficult it is to implement the RowTest feature of MbUnit as NUnit Addin. Two hours later the RowTest Extension for NUnit was ready. I released the extension under the MIT license.
The following code snippet shows you how to use the extension:
[TestFixture]
public class RowTestSample
{
[RowTest]
[Row( 1000, 10, 100.0000)]
[Row(-1000, 10, -100.0000)]
[Row( 1000, 7, 142.85715)]
[Row( 1000, 0.00001, 100000000)]
[Row(4195835, 3145729, 1.3338196)]
public void DivisionTest(double num, double den, double res)
{
Assert.AreEqual(res, num / den, 0.00001);
}
}
The current release does not support all features of MbUnit RowTests, e.g. Exceptions cannot be tested.
Technorati Tags NUnit, nunitaddin, rowtest, unit-testing