Archive for June, 2009

NBuilder website launched

Posted on June 14, 2009. Filed under: Uncategorized |

I’ve created a website for NBuilder.

I’ve created some documentation for the main features which I’ll be adding to over the coming weeks.

Please check it out –

Read Full Post | Make a Comment ( 1 so far )

Fluent Dates added to NBuilder

Posted on June 6, 2009. Filed under: Uncategorized |

I’ve just published a new release of NBuilder with fluent date support. This means you can specify dates in a nice readable syntax.

The Problem

Say you want to set a date, 21:15 on March 21st 2008

You’d most likely do it something like this:

var date = new DateTime(2009, 03, 21, 21, 15);

This doesn’t read particularly well especially if you have loads of different dates.

The Solution

NBuilder’s fluent dates:

var date = The.Year(2008).On.March.The21st.At(21, 15);

That is the full syntax, there are loads of different variations, for convenience and better readability within different contexts.

No year (defaults to current year):

product.Created = On.March.The21st.At(09, 15);

No time:

product.LastEdited = On.March.The21st;

Using The(x) instead:

product.Created = On.March.The(15)

Using static months instead:

Just having the month without On. might read better in certain situations

myEntity.LastEditedOn = December.The10th

Specifying a time:

TimeSpan time = At.Time(23, 15);


TimeSpan time = The.Time(23, 15);

Today at 2pm:

var date = Today.At(14, 00);

You can use seconds as well:

var dateTime = July.The4th.At(07, 00, 05);

Using in the context of NBuilder

You can use the dates anywhere but in the context of NBuilder it would be something like this:

Fluent dates and NBuilder

Of course you can use the fluent dates with the RandomGenerator too:


Hope you find it useful. Any comments / suggestions, please let me know.

Download NBuilder 2.1.7

Download NBuilder 2.1.7 from google code

Read Full Post | Make a Comment ( None so far )

Liked it here?
Why not try sites on the blogroll...