2010/11/15

MbUnit v3 to support (N)Hamcrest

Recently, Graham Hay did port the well-known Hamcrest library to .NET. The new version of that library was judiciously ;) named NHamcrest. It is also fully integrated to Gallio/MbUnit with Assert.That.

Try it out by downloading the latest v3.3 daily build and give us feedback and suggestions.
[Test]
public void NHamcrestExample()
{
var array = new[] {"red", "green", "blue"};
Assert.That(array, Is.InstanceOf(typeof(string[])));
Assert.That(array, Has.Items(new[] { "green", "red" }));
Assert.That(array, Has.Item<string>(Starts.With("bl")));
}

No comments: