Generate Test Data data using using GenFu and C#

Rajnilari2015
Posted by Rajnilari2015 under C# category on | Points: 40 | Views : 2524
Let us create a Entity as

public class Person
{
public int Id { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string EmailAdress { get; set; }
public string PhoneNumber { get; set; }

public override string ToString()
{
return $"{Id}: {FirstName} {LastName} - {EmailAdress} - {PhoneNumber}";
}

}


Then add GenFu through the Nuget package manager as under

Install-Package GenFu


Finally generate the data

public static void Main(String[] args)
{
//Generate 100 random data
A.ListOf<Person>(100).ToList().Foreach(i=>Console.WriteLine(i.ToString()));
Console.ReadLine();
}

Comments or Responses

Login to post response