Testing Mentor Class Library
PseudoName Members
Generates a random pseudonym from user supplied names.
Constructor
| Name | Description | |
|
|
PseudoNameGenerator | Initializes a new instance of the PseudoNameGenerator class |
Methods
| Name | Description | |
|
|
Pseudonym | Generates a random pseudonym specified by the NameInfo information |
Properties
| Name | Description | |
|
|
NameInfo | Sets the properties to pass to the Pseudonym method of the PseudoNameGenerator |
Remarks
If the NameInfo.Filename property is not set, or if the file location is invalid then Pseudonym will generate an empty string.
If the data file is in an incorrect format then Pseudonym will throw an IndexOutOfRange exception.
If NameInfo.IsFemale or NameInfo.IsMale is not set to true, then Pseudonym will randomly select a name gender.
Example
| using System; using TestingMentor.TestTool.PseudoName; namespace PseudonymGeneratorExample { class RandomName { static void Main() { PseudoNameGenerator png = new PseudoNameGenerator(); png.NameInfo.Filename = Environment.GetFolderPath( Environment.SpecialFolder.Desktop) + "\\names.xlsx"; png.NameInfo.IsFemale = true; string name = png.Pseudonym(); } } } |
This example would return a female given name and a surname from the list of names provided in the names.xlsx data file. (The data file must be in Excel format, and can be either xlsx or xls format.)
Example
| using System; using TestingMentor.TestTool.PseudoName; namespace PseudonymGeneratorExample { class RandomName { static void Main() { PseudoNameGenerator png = new PseudoNameGenerator(); png.NameInfo.Filename = Environment.GetFolderPath( Environment.SpecialFolder.Desktop) + "\\names.xlsx"; png.NameInfo.IsFemale = true; string[] name = png.Pseudonym().Split(new char[] {' '}); } } } |
This example returns a female given name and a surname from a list of names provided in the names.xlsx data file and reads the given name and the surname into a string array.





