Documentation

Sometimes it is necessary that the ObjectFiller should NOT fill the properties of a base class from which your poco derives from. ObjectFiller would also fill this properties by default but you can change this behaviour by calling IgnoreInheritance() in the ObjectFiller setup.

In the following example we see, that the class CompanyAddress is derived from the base class Address.

In the filler setup we call .IgnoreInheritance(). This will lead the ObjectFiller to not create values for the properties City and HouseNumber of the base type Address.

public class Address
{
  public string City { get; set; }
  public int HouseNumber { get; set; }
}

public class CompanyAddress : Address
{
  public string CompanyName { get; set; }
}

public class HelloFiller
{
  public void FillPerson()
  {
    Filler<CompanyAddress> pFiller = new Filler<CompanyAddress>();
    pFiller.Setup()
      .IgnoreInheritance();

    CompanyAddress address = pFiller.Create();
  }
}