Documentation

With ObjectFiller.NET it is possible to instantiate objects which have a constructor WITH arguments.

In the example the property Address in the class person gets ignored because it gets filled by the constructor.

It is also possible to define a setup for the Address by calling .SetupFor<Address> in the fluent API. The addressargument in the constructor of class Person gets than filled with an Addressobject which matches the configuration.

public class Person
{
  public Person(Address address)
  {
    Address = address;
  }

  public string Name { get; set; }
  public string LastName { get; set; }
  public int Age { get; set; }
  public DateTime Birthday { get; set; }
  public Address Address { get; set; }

}

public class Address
{
  public string Street { get; set; }
  public string City { get; set; }
}

public class HelloFiller
{
  public void FillPerson()
  {
    Filler<Person> pFiller = new Filler<Person>();
    pFiller.Setup()
      .OnProperty(x=>x.Address).IgnoreIt();

    Person filledPerson = pFiller.Create();
  }
}