Documentation

Writing your own plugin is very easy.

Just implement the IRandomizerPlugin<T> plugin.

The typeparameter T defines the type for which you will write the plugin.
The interface has just one function which you have to implement: T GetValue();
Thats all! You can write plugins for simple types and complex types.

The following example shows the implementation of the plugin MyFirstPlugin.
The MyFirstPlugin plugin is written for the type string because it is derived from IRandomizerPlugin<string>.

The implementation in the method public string GetValue() takes a random item of a given list. Thats all. Now it is possible to use this plugin everywhere where a value of type string should be genereated.

If you wrote a great plugin, i would be happy to get a pull request on GitHub 😄 👍

public class MyFirstPlugin : IRandomizerPlugin<string>
{
  private readonly Random r = new Random();
  private readonly List<string> allNames = 
  new List<string>() 
  { 
    "Jennifer", 
   	"Jenny", 
   	"Tom", 
   	"John" 
  };

  public string GetValue()
  {
    return allNames[r.Next(0, allNames.Count)];
  }
}

public class Person
{
  public string Name { get; set; }
}

public class HelloFiller
{
  public void FillPerson()
  {
    Filler<Person> pFiller = new Filler<Person>();
    pFiller.Setup()
      .OnType<string>().Use(new MyFirstPlugin());

    Person filledPerson = pFiller.Create();
  }
}