RimuTec.Faker 0.39.0

A library for generating fake data e.g. for authoring tests, for preparing software demos or for creating screenshots. It includes generators such as Lorem text, Addresses, Company, PhoneNumber, Job Titles, etc. It comes with support for 51 locales out of the box and can be extended with custom locales. Licensed under the MIT license.

There is a newer version of this package available.
See the version list below for details.
Install-Package RimuTec.Faker -Version 0.39.0
dotnet add package RimuTec.Faker --version 0.39.0
<PackageReference Include="RimuTec.Faker" Version="0.39.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add RimuTec.Faker --version 0.39.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Faker

RimuTec.Faker provides generators for fake, yet realistically looking data. Use it for testing, for creating screenshots to show off your cool software, and similar more. Generators include Lorem, Name, Address, Date, Company, Business, and many more.

RimuTec.Faker is a C# port of the Ruby Faker gem https://github.com/stympy/faker.

RimuTec.Faker targets .NET Standard 2.0 (netstandard2.0) and .NET Framework 4.6.2 (net462). The library including its source code are licensed under the MIT license. It supports 51 locales out of the box. And you can extend it with your own custom locales using yaml files.

| Metric | Status |
| ----- | ----- |
| Nuget | NuGet Badge |

Installation

RimuTec.Faker is available as a NuGet package. To install follow the instructions at https://www.nuget.org/packages/RimuTec.Faker/.

Available Fake Data Generators

The classes listed below are already ported. Our aim is to add the remaining classes and method over time. If you have preferences please file suggestions as issues on Github (see below). Thank you!

Supported Locales and Customization

The following 51 locales are supported out of the box (no extra files needed):

bg, ca, ca-CAT, da-DK, de, de-AT, de-CH, ee, en, en-AU, en-au-ocker, en-BORK, en-CA, en-GB, en-IND, en-MS, en-NEP, en-NG, en-NZ, en-PAK, en-SG, en-UG, en-US, en-ZA, es, es-MX, fa, fi-FI, fr, fr-CA, fr-CH, he, id, it, ja, ko, lv, nb-NO, nl, no, pl, pt, pt-BR, ru, sk, sv, tr, uk, vi, zh-CN, zh-TW

To set the locale use something like Config.Locale = &quot;de&quot;;.

In addition you can use custom locale files for methods that are marked with an asterisk. Ensure that the custom locale file (yml) is copied to the directory that also contains RimuTec.Faker.dll, usually the output directory of your test project.

Address

  • BuildingNumber()
  • City()
  • CityPrefix()
  • CitySuffix()
  • Community()
  • Country()
  • CountryCode()
  • CountryCodeLong()
  • FullAddress()
  • Latitude()
  • Longitude()
  • Postcode(string stateAbbreviation = "")
  • SecondaryAddress()
  • State()
  • StateAbbr()
  • StreetAddress(bool includeSecondary = false)
  • StreetName()
  • StreetSuffix()
  • TimeZone()
  • Zip(string stateAbbreviation = "")
  • ZipCode(string stateAbbreviation = "")

Business

  • CreditCardExpiryDate()
  • CreditCardNumber()
  • CreditCardType()

Code

  • Asin()
  • Ean(int @base = 13)
  • Imei()
  • Isbn(int @base = 10)
  • Npi()
  • Nric(int minAge = 18, int maxAge = 65)
  • Rut()
  • Sin()

Company

  • AustralianBusinessNumber()
  • Bs()
  • Buzzword()
  • CatchPhrase()
  • CzechOrganizationNumber()
  • DunsNumber()
  • Ein()
  • FrenchSirenNumber()
  • FrenchSiretNumber()
  • Industry()
  • Logo()
  • Name()
  • NorwegianOrganizationNumber()
  • PolishRegisterOfNationalEconomy(int length = 9)
  • PolishTaxpayerIdentificationNumber()
  • Profession()
  • SpanishOrganizationNumber()
  • Suffix()
  • SwedishOrganizationNumber()
  • Type()

Date

  • Backward(int days = 365)
  • Between(DateTime minDate, DateTime maxDate)
  • BetweenExcept(DateTime from, DateTime to, DateTime excepted)
  • Birthday(int minAge = 18, int maxAge = 65)
  • Forward(int days = 365)

Educator

  • Campus()
  • Course()
  • SecondarySchool()
  • University()

Finance

  • CreditCard(params CreditCardType[] types)

IDNumber

  • SpanishForeignCitizenNumber()
  • Invalid()
  • SpanishCitizenNumber()
  • Valid()

Internet

  • DomainName()
  • DomainSuffix()
  • DomainWord()
  • Email(string name = null, string separators = null)
  • FreeEmail(string name = null)
  • IPv4Address()
  • IPv4CIDR()
  • IPv6Address()
  • IPv6CIDR()
  • MacAddress(string prefix = "")
  • Password(int minLength = 8, int maxLength = 15, bool mixCase = true, bool specialChars = true)
  • PrivateIPv4Address()
  • PublicIPv4Address()
  • SafeEmail(string name = null)
  • Slug(string words = null, string glue = null)
  • Url(string host = null, string path = null, string scheme = "http")
  • UserAgent(string vendor = null)
  • UserName(int minLength, int maxLength = int.MaxValue)
  • UserName(string name = null, string separators = null)

Job

  • EmploymentType()
  • EducationLevel()
  • Field()
  • KeySkill()
  • Position()
  • Seniority()
  • Title()

Lorem

  • Character()
  • Characters(int charCount = 255)
  • Multibyte()
  • Paragraph(int sentenceCount = 3, bool supplemental = false, int randomSentencesToAdd = 0)
  • ParagraphByChars(int chars = 256, bool supplemental = false)
  • Paragraphs(int paragraphCount = 3, bool supplemental = false)
  • Question(int wordCount = 4, bool supplemental = false, int randomWordsToAdd = 0)
  • Questions(int questionCount = 3, bool supplemental = false)
  • Sentence(int wordCount = 4, bool supplemental = false, int randomWordsToAdd = 0)
  • Sentences(int sentenceCount = 3, bool supplemental = false)
  • Word()
  • Words(int wordCount = 3, bool supplemental = false)

Name

  • FirstName()
  • FullName() (equivalent to Ruby's Faker::Name.name)
  • Initials(int characterCount)
  • LastName()
  • MiddleName()
  • NameWithMiddle()
  • Prefix()
  • Suffix()

PhoneNumber

  • CellPhone()
  • LandLine(): Equivalent to Ruby Faker::PhoneNumber.phone_number

RandomNumber

  • Next()
  • NextDouble()
  • Next(int maxValue)
  • Next(int minValue, int maxValue)
  • ResetSeed(int seed)

Usage

Quick Start

  1. Install NuGet package. See https://www.nuget.org/packages/RimuTec.Faker for instructions
  2. Add using RimuTec.Faker; at the beginning of your C# source file (or the equivalent for your preferred .NET language)
  3. Generate fake data, e.g. var firstName = Name.NameWithMiddle();

In case of name clashes with other classes in your code base, use one of the following techniques in C# source files:

  1. use fully qualify names, e.g. var firstName = RimuTec.Faker.Name.NameWithMiddle();. Use this if there are only a couple of occurances.
  2. add using NameFaker = RimuTec.Faker.Name; at the beginning of the file and then var firstName = NameFaker.NameWithMiddle();. Use this option if you have many usages within the source file.

Release Notes

Release notes are available at https://github.com/RimuTec/Faker/blob/master/releasenotes.md

Support & Suggestions

If you need support or have a suggestion for improvement please file an issue at https://github.com/RimuTec/Faker/issues. Thank you!

Reporting Bugs

RimuTec.Faker has a test suite with about 270 unit tests. This does not guarantee absence of bugs. Please report all bugs at https://github.com/RimuTec/Faker/issues ideally including steps to reproduce. We also consider pull requests (PR). All your feedback will help make the library more valuable for other users as well. Thank you!

How To Build

Visual Studio 2017

Open Faker.sln in Visual Studio, select the desired configuration ("DEBUG" or "RELEASE") and then build the solution.

Command Line

  1. Open Powershell and navigate to directory containing Faker.sln
  2. Execute the command dotnet build --configuration RELEASE Faker.sln. Replace RELEASE with DEBUG if you want build the DEBUG configuration

Issues With Building

If you encounter issues with building the library please file an issue on GitHub, ideally with what you tried, what the expected and what the actual outcome was. Thank you!

Credits

This project uses the yaml files from the Ruby Faker gem, licensed under the MIT license. Thank you to all their contributors!

Faker

RimuTec.Faker provides generators for fake, yet realistically looking data. Use it for testing, for creating screenshots to show off your cool software, and similar more. Generators include Lorem, Name, Address, Date, Company, Business, and many more.

RimuTec.Faker is a C# port of the Ruby Faker gem https://github.com/stympy/faker.

RimuTec.Faker targets .NET Standard 2.0 (netstandard2.0) and .NET Framework 4.6.2 (net462). The library including its source code are licensed under the MIT license. It supports 51 locales out of the box. And you can extend it with your own custom locales using yaml files.

| Metric | Status |
| ----- | ----- |
| Nuget | NuGet Badge |

Installation

RimuTec.Faker is available as a NuGet package. To install follow the instructions at https://www.nuget.org/packages/RimuTec.Faker/.

Available Fake Data Generators

The classes listed below are already ported. Our aim is to add the remaining classes and method over time. If you have preferences please file suggestions as issues on Github (see below). Thank you!

Supported Locales and Customization

The following 51 locales are supported out of the box (no extra files needed):

bg, ca, ca-CAT, da-DK, de, de-AT, de-CH, ee, en, en-AU, en-au-ocker, en-BORK, en-CA, en-GB, en-IND, en-MS, en-NEP, en-NG, en-NZ, en-PAK, en-SG, en-UG, en-US, en-ZA, es, es-MX, fa, fi-FI, fr, fr-CA, fr-CH, he, id, it, ja, ko, lv, nb-NO, nl, no, pl, pt, pt-BR, ru, sk, sv, tr, uk, vi, zh-CN, zh-TW

To set the locale use something like Config.Locale = &quot;de&quot;;.

In addition you can use custom locale files for methods that are marked with an asterisk. Ensure that the custom locale file (yml) is copied to the directory that also contains RimuTec.Faker.dll, usually the output directory of your test project.

Address

  • BuildingNumber()
  • City()
  • CityPrefix()
  • CitySuffix()
  • Community()
  • Country()
  • CountryCode()
  • CountryCodeLong()
  • FullAddress()
  • Latitude()
  • Longitude()
  • Postcode(string stateAbbreviation = "")
  • SecondaryAddress()
  • State()
  • StateAbbr()
  • StreetAddress(bool includeSecondary = false)
  • StreetName()
  • StreetSuffix()
  • TimeZone()
  • Zip(string stateAbbreviation = "")
  • ZipCode(string stateAbbreviation = "")

Business

  • CreditCardExpiryDate()
  • CreditCardNumber()
  • CreditCardType()

Code

  • Asin()
  • Ean(int @base = 13)
  • Imei()
  • Isbn(int @base = 10)
  • Npi()
  • Nric(int minAge = 18, int maxAge = 65)
  • Rut()
  • Sin()

Company

  • AustralianBusinessNumber()
  • Bs()
  • Buzzword()
  • CatchPhrase()
  • CzechOrganizationNumber()
  • DunsNumber()
  • Ein()
  • FrenchSirenNumber()
  • FrenchSiretNumber()
  • Industry()
  • Logo()
  • Name()
  • NorwegianOrganizationNumber()
  • PolishRegisterOfNationalEconomy(int length = 9)
  • PolishTaxpayerIdentificationNumber()
  • Profession()
  • SpanishOrganizationNumber()
  • Suffix()
  • SwedishOrganizationNumber()
  • Type()

Date

  • Backward(int days = 365)
  • Between(DateTime minDate, DateTime maxDate)
  • BetweenExcept(DateTime from, DateTime to, DateTime excepted)
  • Birthday(int minAge = 18, int maxAge = 65)
  • Forward(int days = 365)

Educator

  • Campus()
  • Course()
  • SecondarySchool()
  • University()

Finance

  • CreditCard(params CreditCardType[] types)

IDNumber

  • SpanishForeignCitizenNumber()
  • Invalid()
  • SpanishCitizenNumber()
  • Valid()

Internet

  • DomainName()
  • DomainSuffix()
  • DomainWord()
  • Email(string name = null, string separators = null)
  • FreeEmail(string name = null)
  • IPv4Address()
  • IPv4CIDR()
  • IPv6Address()
  • IPv6CIDR()
  • MacAddress(string prefix = "")
  • Password(int minLength = 8, int maxLength = 15, bool mixCase = true, bool specialChars = true)
  • PrivateIPv4Address()
  • PublicIPv4Address()
  • SafeEmail(string name = null)
  • Slug(string words = null, string glue = null)
  • Url(string host = null, string path = null, string scheme = "http")
  • UserAgent(string vendor = null)
  • UserName(int minLength, int maxLength = int.MaxValue)
  • UserName(string name = null, string separators = null)

Job

  • EmploymentType()
  • EducationLevel()
  • Field()
  • KeySkill()
  • Position()
  • Seniority()
  • Title()

Lorem

  • Character()
  • Characters(int charCount = 255)
  • Multibyte()
  • Paragraph(int sentenceCount = 3, bool supplemental = false, int randomSentencesToAdd = 0)
  • ParagraphByChars(int chars = 256, bool supplemental = false)
  • Paragraphs(int paragraphCount = 3, bool supplemental = false)
  • Question(int wordCount = 4, bool supplemental = false, int randomWordsToAdd = 0)
  • Questions(int questionCount = 3, bool supplemental = false)
  • Sentence(int wordCount = 4, bool supplemental = false, int randomWordsToAdd = 0)
  • Sentences(int sentenceCount = 3, bool supplemental = false)
  • Word()
  • Words(int wordCount = 3, bool supplemental = false)

Name

  • FirstName()
  • FullName() (equivalent to Ruby's Faker::Name.name)
  • Initials(int characterCount)
  • LastName()
  • MiddleName()
  • NameWithMiddle()
  • Prefix()
  • Suffix()

PhoneNumber

  • CellPhone()
  • LandLine(): Equivalent to Ruby Faker::PhoneNumber.phone_number

RandomNumber

  • Next()
  • NextDouble()
  • Next(int maxValue)
  • Next(int minValue, int maxValue)
  • ResetSeed(int seed)

Usage

Quick Start

  1. Install NuGet package. See https://www.nuget.org/packages/RimuTec.Faker for instructions
  2. Add using RimuTec.Faker; at the beginning of your C# source file (or the equivalent for your preferred .NET language)
  3. Generate fake data, e.g. var firstName = Name.NameWithMiddle();

In case of name clashes with other classes in your code base, use one of the following techniques in C# source files:

  1. use fully qualify names, e.g. var firstName = RimuTec.Faker.Name.NameWithMiddle();. Use this if there are only a couple of occurances.
  2. add using NameFaker = RimuTec.Faker.Name; at the beginning of the file and then var firstName = NameFaker.NameWithMiddle();. Use this option if you have many usages within the source file.

Release Notes

Release notes are available at https://github.com/RimuTec/Faker/blob/master/releasenotes.md

Support & Suggestions

If you need support or have a suggestion for improvement please file an issue at https://github.com/RimuTec/Faker/issues. Thank you!

Reporting Bugs

RimuTec.Faker has a test suite with about 270 unit tests. This does not guarantee absence of bugs. Please report all bugs at https://github.com/RimuTec/Faker/issues ideally including steps to reproduce. We also consider pull requests (PR). All your feedback will help make the library more valuable for other users as well. Thank you!

How To Build

Visual Studio 2017

Open Faker.sln in Visual Studio, select the desired configuration ("DEBUG" or "RELEASE") and then build the solution.

Command Line

  1. Open Powershell and navigate to directory containing Faker.sln
  2. Execute the command dotnet build --configuration RELEASE Faker.sln. Replace RELEASE with DEBUG if you want build the DEBUG configuration

Issues With Building

If you encounter issues with building the library please file an issue on GitHub, ideally with what you tried, what the expected and what the actual outcome was. Thank you!

Credits

This project uses the yaml files from the Ruby Faker gem, licensed under the MIT license. Thank you to all their contributors!

Release Notes

Relase notes listing new features and other changes are available at https://github.com/RimuTec/Faker/blob/master/releasenotes.md

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
0.40.0 271 8/5/2018
0.39.0 188 7/29/2018
0.38.0 176 7/27/2018
0.37.0 180 7/26/2018
0.36.0 175 7/25/2018
0.35.0 168 7/24/2018
0.34.0 185 7/23/2018
0.33.0 189 7/22/2018
0.32.0 198 7/17/2018
0.31.0 216 7/17/2018
0.30.0 193 7/15/2018
0.29.0 218 7/14/2018
0.28.0 221 7/13/2018
0.27.0 198 7/12/2018
0.26.0 212 7/11/2018
0.25.0 218 7/10/2018
0.24.0 219 7/9/2018
0.23.0 220 7/8/2018
0.22.0 178 7/7/2018
0.21.0 201 7/6/2018
0.20.0 219 7/5/2018
0.19.0 216 7/4/2018
0.18.0 229 7/4/2018
0.17.0 207 7/2/2018
0.16.0 231 7/1/2018
0.15.0 233 6/30/2018
0.14.0 187 6/29/2018
0.13.0 184 6/28/2018
0.12.0 227 6/27/2018
0.11.0 232 6/26/2018
0.10.0 206 6/25/2018
0.9.0 239 6/24/2018
0.8.0 220 6/23/2018
0.7.0 220 6/22/2018
0.6.0 279 6/21/2018
0.5.0 230 6/20/2018
0.4.0 221 6/20/2018
0.3.0 225 6/19/2018
0.2.0 220 6/19/2018
0.1.0 207 6/18/2018