-
Notifications
You must be signed in to change notification settings - Fork 0
QuickStart
William Wilcox edited this page Feb 16, 2013
·
4 revisions
Using nuget
PM> Install-Package PocoGenerator -Version 1.0.0
Below is a complete, albeit simple program using PocoGenerator
. See Example for a longer one.
using PocoGenerator;
using System;
namespace PocoGeneratorExample
{
class Program
{
static void Main(string[] args) {
var generator = new PocoGenerator<Person>(new Random(142))
.For(x => x.Name).Use(Generators.FromFemaleFirstNames())
.For(x => x.Bio).Use(Generators.FromLoremIpsum(25))
.For(x => x.Id).Use(Generators.LongSequence(0, 1));
foreach (Person p in generator.Make(2))
Console.WriteLine(p.ToString());
}
}
class Person
{
public String Name { get; set; }
public String Bio { get; set; }
public long Id { get; set; }
public override string ToString() {
return "[" + Id + "] " + Name + "\n\t" + Bio;
}
}
}
Output
[0] Sierra
largior aegresco somnio f
[1] Eileen
Marcieniensis positus min
[2] Laurie
Taruennam forsit dolose g