NBuilder does not currently support automatic filling of reference types.
However, you can do what you want by using the constructor to create each reference type.
You are probably doing this at the moment:
var person = Builder<Person> .CreateNew() .Build(); Assert.That(person.Name, Is.EqualTo("Name1")); Assert.That(person.Address, Is.Null);
What you want to do is:
var address = Builder<Address> .CreateNew() .Build(); var person2 = Builder<Person> .CreateNew() .With(x => x.Address = address) .Build(); Assert.That(person2.Name, Is.EqualTo("Name1")); Assert.That(person2.Address, Is.Not.Null); Assert.That(person2.Address.Street, Is.EqualTo("Street1")); Assert.That(person2.Address.Zipcode, Is.EqualTo("Zipcode1"));
source share