When you call the .Setup(true) method, it will just fill properties which was explicit configured.
This is useful if you want to take full control about the object generation.
This is useful if you want to take full control about the object generation.
In the following example all properties gets ignored by the ObjectFiller.NET except the LastName property. This is because the Filler-Setup is called with parameter true which starts the Setup in explicit mode, so every property have to be configured explicit.
public class Person
{
public string Name { get; set; }
public string LastName { get; set; }
public int Age { get; set; }
public DateTime Birthday { get; set; }
}
public class HelloFiller
{
public void FillPerson()
{
Filler<Person> pFiller = new Filler<Person>();
pFiller.Setup(true)
.OnProperty(x=>x.LastName).Use<RealNames>();
Person filledPerson = pFiller.Create();
}
}