Search The Blog
About this site

@RoyOsherove

Subscribe!

This site aims to connect all the dots of my online activities - from tools, books blogs and twitter accounts, to upcoming conferences, engagements and user group talks.

from 5whys.com
Twitter: @RoyOsherove
My Book: The Art of Unit Testing
Latest Posts
« Unit Testing Biztalk : Two possible frameworks | Main | How SilverUnit can help you be famous »
Monday
Jan112010

Poll: Do you use NUnit’s fluent API?

if you use NUnit, did you know it has a fluent API option? Do you use it?

you can write the following:

Assert.That( someString,
      Is.Not.Null

      .And.Not.Empty
      .And.EqualTo("foo")
      .And.Not.EqualTo("bar")
      .And.StartsWith("f"));


Assert.That(someEnumerable,
    Has.Count.EqualTo(2),
    .And.Contains.Some.Matches(x => x.FirstName == "Jim")
    .And.Contains.None.Matches(x => x.LastName == "Jones"));

Assert.That( x => <some code>,

    Throws.TypeOf<ArgumentException>().With.Message.EqualTo("Too Bad!");

PrintView Printer Friendly Version

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>