Skip to content

PlanBernhard/PersonGenerator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Info

Simple helper class to generate a mock person object. The object will be created from two List's that are given as argument.

Usage

var mockPerson = new MockPerson(List<string>, List<string>);

or

var mockPerson = new MockPerson(List<string>, List<string>, DateTime);

The method overload supports up to three arguments in the constructor:

Method arguments

Argument Function Type Required
Firstname List to get random name List Yes
Lastname List to get random name List Yes
Birthday Startdate to get random date between this date and today DateTime No

Object properties

Name Description
Firstname string of Firstname
Lastname string of Lastname
Birthday DateTime of birthday

Example

  List<string> firstnameList = new List<string>(){ "Mary", "Bob", "Joe", "Barbara", "Tom", "Linda" };
  List<string> lastnameList = new List<string>(){ "Smith", "Johnson", "Williams", "Brown", "Jones", "Miller", "Davis" };
  
  MockPerson mockPerson = new MockPerson(firstnameList, lastnameList);
  
  Console.WriteLine($"New Person: {mockPerson.FirstName} {mockPerson.LastName} born {mockPerson.Birthday}");

Remarks

If the method is used without a birthday argument the logic will take a date between 1.1.1970 and DateTime.Today.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages