xUnit.NET
A while ago xUnit.NET came out, and I checked it out, decided that it didn't offer me anything really interesting, and moved on.
I was wrong. Or, to be rather exact, I didn't dug deep enough. xUnit.NET doesn't really offer something that we haven't seen elsewhere, but today I had the chance to do some work on the it a bit, and I found some interesting things.
I am not sure why xUnit.NET is using [Fact] instead of [Test], but aside from that, it is a really nice framework. Most significantly, I like the use of Assert.DoesNotThrows(delegate); It makes it very clear what is supposed to happen, instead of the more awkward syntax in other places.
What has sparked this post is that I wanted to have a parameterized test. Now, I know that xUnit.NET has this feature somewhere, but I decided to take a look inside (one of my standard procedures before I am using a library). What I found out was very pleasing.
In fact, I still don't know what the standard way to deal with that scenario in xUnit.NET (well, I know it is called [Theory], but I don't know the exact syntax). The reason that I don't know the exact syntax is very simple.
It was easier to write my own than to learn the official syntax. That is a rare pleasure.
I haven't actually looked at NUnit or MbUnit code, so I have no idea how they are looking, but it was a lot of fun trawling through xUnit.NET on reflector.
Comments
most valued feature: xcopy deployment. no GAC, no more nunit 2.4/2.2 crap.
it makes it a gr8 choice for opensource projects - switched AspView to xUnit because of that.
And why exactly do you need to travel through xUnit with a Reflector if it's open source? Or I don't understand what open source mean.
@Alex
It makes it easier to use reflector since, you click a function and it takes you to the right spot, even if it is in the .net framework. I have used reflector many times even when I had the actual source. It is just easier.
I am using NBehave right now, and while it can be used as an extension to existing testing frameworks, I find the sugar it adds to be very useful.
xUnit.Net is pretty cool and it's coming along nicely.
So is MbUnit v3. For example...
[Test]
[Row(typeof(int), 42, "42")]
[Row(typeof(string), "Abc", "Abc")]
[Row(typeof(DateTime), "2007/02/03", "02/03/2007 12:00:00am")] // note: the expected result here is locale-dependent but the value datatype conversion is not
[Row(typeof(XmlDocument), "<root>42</root>", "<root>42</root>")] // or whatever an XmlDocument prints out when ToString'd
public void ToString<T>(T value, string expectedResult)
{
}
Notice:
Binding works with generic parameters.
There are automatic datatype conversions (this is extensible).
Comment preview