Skip to content

Instantly share code, notes, and snippets.

@pykong
Created April 27, 2018 09:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pykong/66ac7c14174b854a46cc824ed64cbab0 to your computer and use it in GitHub Desktop.
Save pykong/66ac7c14174b854a46cc824ed64cbab0 to your computer and use it in GitHub Desktop.
https://github.com/diogolmenezes/Faker PM> Install-Package FakerTest
public class User
{
public string Name { get; set; }
public string Email { get; set; }
public int Age { get; set; }
public DateTime CreatedAt { get; set; }
}
// creating one fake user
var user = new Faker<User>().Create();
// creating 10 fake users
var user = new Faker<User>().CreateMany(10);
// creating 10 users with real names and real mail adresses
var user = new Faker<User>().CreateMany(10, x=> { x.Name = new NameGenerator().Get(); x.Email = new EmailGenerator().Get() });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment