Given the following classes:
class Department
{
public String Name { get; set; }
public IList<Employee> Employees { get; set; }
}
class Employee
{
public String Name { get; set; }
public String Address { get; set; }
}
With NBuilder I can create a department object and assign 10 employees the following way:
var employees = Builder<Employee>.CreateListOfSize(10).Build();
var department = Builder<Department>
.CreateNew()
.With(d=>d.Employees = employees)
.Build();
This works with a small number of collections but it gets cumbersome with a large one. Is there a way to have NBuilder populate all collections in the object automatically?
By the way, I'm not tied to NBuilder so if there's another free library that does this I'd be more than happy to switch.