Documentation

With the Collectionizer plugin it is possible to generate lists filled with values based on other randomizer plugins. For example you have a List<string> in your POCO class and you want to have it filled with city names of the CityName string plugin.

In the following example there are two lists in the class CountryInformations.
In the property setup is specified that the property CityNames will be filled with the CityName-string plugin and that the list shall have a count between 10 and 100 items (new Collectionizer<string, CityName>(10, 100)).

The property FirstNames shall be filled with FirstNames of the RealNames plugin and a minimum count of 10 (new Collectionizer<string, RealNames>(new RealNames(NameStyle.FirstName), 10)) .

public class CountryInformations
{
  public List<string> CityNames { get; set; }
  public IEnumerable<string> FirstNames { get; set; }
}

public class HelloFiller
{
  public void FillPerson()
  {
    Filler<CountryInformations> pFiller = new Filler<CountryInformations>();
    pFiller.Setup()
      .OnProperty(x => x.CityNames).Use(new Collectionizer<string, CityName>(10, 100))
      .OnProperty(x => x.FirstNames).Use(new Collectionizer<string, RealNames>(new RealNames(NameStyle.FirstName), 10));

    CountryInformations countryInfo = pFiller.Create();
  }
}