Please see the official website: http://nbuilder.org
Source has been moved to GitHub under: https://github.com/garethdown44/nbuilder/
Some bug fixes and patches, courtesy of Joshua Roth.
Also revised the syntax. Now building lists and building single objects share the same method names.
For example, where it used to be:
Builder<Product>.CreateNew().With(x => x.Title = "some title").Build(); Builder<Product>.CreateListOfSize(10).WhereAll().Have(x => x.Title = "some title").Build();
Now the syntax for building a list is:
Builder<Product>.CreateListOfSize(10).All().With(x => x.Title = "some title").Build();
The old syntax methods are still there but have been marked [Obsolete]. Please note though that a build is included where these methods are not obsolete. This is for cases where people don't want compiler warnings about using [Obsolete] methods.
The recommended approach though is to find-and-replace and convert the old syntax to the new. The changes are as follows:
WhereAll() -> All() WhereTheFirst() -> TheFirst() WhereTheLast() -> TheLast() WhereSection() -> Section() WhereRandom() -> Random() AndTheNext() -> TheNext() AndThePrevious() -> ThePrevious() AndTheLast() -> TheLast() Have() -> With() Has() -> With()
I'll be posting up a script in the next few days to find and replace all method calls within a codebase.
This adds support for silverlight. Both the 3.5 CLR and a Silverlight 3 version are included in the zip file. Also includes some other very minor bug fixes.
Since there are a few patches and new features all at once, I thought it would be best to issue a beta release. Please report any issues.
Builder<Product>.CreateNew() .WithConstructor( () => new Product("title", 5.5m) ) .Build()
Thanks to Kevin Kuebler for finding the defects, fixing both of them and implementing enum support!
To see it in action please see the Overview/HowTo page