Getting Started


You can get started with generating sample data right away by letting Fabricator generate all values for you. Later, as your needs change, you can customise how your data is generated by defining your own rules.

First Steps

If you have a class with the following definition:

class SampleData
{
    public int Number { get; set; }
    public string Name { get; set; }
}

You can generate sample data using:

var sampleItem = Fabricator.Generate<SampleData>();

This will create a sample item with the following values:

Number: 1
Name: "Name1"

Or if you need more sample data items they can be generated using:

var sampleItems = Fabricator.Generate<SampleData>(100);

Which will create 100 sample items with logical values for each field. The 100th item will have the following values:

Number: 100
Name: "Name100"


Next steps

  • Understand which properties Fabricator will attempt to generate useful data for based on conventions and how to apply these to properties Fabricator doesn't recognise.
  • Learn how to customise the rules used to generate values

Last edited Nov 21, 2010 at 11:04 AM by JRoughan, version 9

Comments

No comments yet.