If you love NUnit you’ll go gaga over MBUnit.
Impressions
Just when you thought it cannot get any better somebody comes up with a better way to do test driven development (TDD). MBUnit is building on the solid foundations laid by NUnit so you are greeted with the familiar attributes and test fixtures out of the box. The fun starts when you go beyond the NUnit clone and find that MBUnit will generate the unit tests on the fly and you have functionality such as RowTest. The RowTest attribute extends the Test attribute by letting you specify multiple variations of test data. Take a look at this example:
1 [RowTest]
2 [Row(10, 10, "Good widget")]
2 [Row(-1, 10, "Not so good", ExpectedException=typeof(InvalidWidgetDataException))]
2 [Row(10, -1, "almost good", ExpectedException=typeof(InvalidWidgetDataException))]
2 [Row(10, 10, null, ExpectedException=typeof(InvalidWidgetDataException))]
2 [Row(-1, 10, "", ExpectedException=typeof(InvalidWidgetDataException))]
6 public void SaveWidget (Int32 width, Int32 height, String comment)
7 {
8 Widget widget = new Widget();
9 widget.Height = height;
10 widget.Width = width;
11
12 widget.Save();
13
14 Widget loadedWidget = Widget.Load(widget.ID);
15 Assert.IsNotNull(loadedWidget, "Widget not found");
16 Assert.AreEqual(widget.Height, loadedWidget.Height, "Height not saved correctly");
16 Assert.AreEqual(widget.Width, loadedWidget.Width, "Weight not saved correctly");
16 Assert.AreEqual(widget.Comment, loadedWidget.Comment, "Comment not saved correctly");
18 }
One problem I ran into was when using a DateTime type in the Row data.
Price
Free.
Conclusion
If you do the TDD then this is a must have, 5 stars!
Get MBunit from here: http://www.mbunit.com/
