Documentation

With ObjectFiller.NET it is possible to use the static Enumerable class to fill objects.
Use it for example when you want to fill a property in a specific order with include and exclude and all the other cool stuff which Enumerable and LINQ supports.

In the following example the ID of an Address item will be an even number between 1 and 100 in ascending order. This means, the first Address will have the Id 2, the second the Id 4, the fourth Id 6 and so...

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

  public List<Address> Addresses { get; set; }
}

public class Address
{
  public int Id { get; set; }

  public string Street { get; set; }
}

public class HelloFiller
{
  public void FillPerson()
  {
    Filler<Person> pFiller = new Filler<Person>();
    pFiller.Setup()
      .SetupFor<Address>()
      .OnProperty(x => x.Id).Use(Enumerable.Range(1, 100).Where(x => x % 2 == 0));

    Person filledPerson = pFiller.Create();
  }
}