Single Objects

Creating a single object

This will build an object with default values for all the properties that NBuilder is able to set.

Setting the value of a property

This will assign default values to everything apart from the description to which it will assign "A custom description here"

Setting more than one property

You can set any number of properties on the object. And() internally is in fact exactly the same as With(). It is provided as an option for improved readability.

Supplying constructor parameters

Given you have a type that has a constructor:

You can supply constructor args using the WithConstructorArgs() method:

Calling a method on an object

You can use Do() to call a method on an object

Do(), And()

Using "multi functions"

If you want to call the same method for each item of a list, you can use DoForAll()