xUnit.NET

time to read 2 min | 259 words

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.