RimuTec.Faker
0.34.0
See the version list below for details.
dotnet add package RimuTec.Faker --version 0.34.0
NuGet\Install-Package RimuTec.Faker -Version 0.34.0
<PackageReference Include="RimuTec.Faker" Version="0.34.0" />
paket add RimuTec.Faker --version 0.34.0
#r "nuget: RimuTec.Faker, 0.34.0"
// Install RimuTec.Faker as a Cake Addin #addin nuget:?package=RimuTec.Faker&version=0.34.0 // Install RimuTec.Faker as a Cake Tool #tool nuget:?package=RimuTec.Faker&version=0.34.0
Faker
A C# port of the Ruby Faker gem https://github.com/stympy/faker. RimuTec.Faker aims at achieving parity with Ruby Faker. Classes that are on par with Ruby Faker are marked accordingly (see below).
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.
Metric | Status |
---|---|
Nuget |
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
Because Ruby Faker has a large number of generators, we had to start with a small set of classes. 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
The following 51 locales are supported out of the box:
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
Classes and Methods that already make use of locales are marked with an asterisk (*) below. To set a locale set the locale using Config.Locale = "de"
.
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
This class is on par with Ruby Faker for default locale ("en").
- 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
This class is on par with Ruby Faker for default locale ("en").
- CreditCardExpiryDate()
- CreditCardNumber()
- CreditCardType()
Code
This class is on par with Ruby Faker for default locale ("en").
- Asin()
- Ean(int @base = 13)
- Imei()
- Isbn(int @base = 10)
- Npi()
- Nric(int minAge = 18, int maxAge = 65)
- Rut()
- Sin()
Company
This class is on par with Ruby Faker for default locale ("en").
- AustralianBusinessNumber()
- Bs()
- Buzzword()
- CatchPhrase()
- CzechOrganizationNumber()
- DunsNumber()
- Ein()
- FrenchSirenNumber()
- FrenchSiretNumber()
- Industry()
- Logo()
- Name()
- NorwegianOrganizationNumber()
- PolishRegisterOfNationalEconomy(int length = 9)
- PolishTaxpayerIdentificationNumber()
- Profession()
- SpanishOrganizationNumber()
- Suffix()
- SwedishOrganizationNumber()
- Type()
Date
This class is on par with Ruby Faker for default locale ("en").
- 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
This class is on par with Ruby Faker for default locale ("en").
- Campus()
- Course()
- SecondarySchool()
- University()
Finance
This class is on par with Ruby Faker for default locale ("en").
- CreditCard(params CreditCardType[] types)
IDNumber
This class is on par with Ruby Faker for default locale ("en").
- SpanishForeignCitizenNumber()
- Invalid()
- SpanishCitizenNumber()
- Valid()
Internet
This class is on par with Ruby Faker for default locale ("en").
- 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
This class is on par with Ruby Faker for default locale ("en").
- 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 *
This class is on par with Ruby Faker for all locales and customization.
- 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
- Install NuGet package. See https://www.nuget.org/packages/RimuTec.Faker for instructions
- Add
using RimuTec.Faker;
at the beginning of your C# source file (or the equivalent for your preferred .NET language) - 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:
- use fully qualify names, e.g.
var firstName = RimuTec.Faker.Name.NameWithMiddle();
. Use this if there are only a couple of occurances. - add
using NameFaker = RimuTec.Faker.Name;
at the beginning of the file and thenvar 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!
Credits
This project uses the yaml files from the Ruby Faker gem, licensed under the MIT license. Thank you to all their contributors!
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.6.2
- Microsoft.CSharp (>= 4.5.0)
- Microsoft.Net.Compilers (>= 2.8.2)
- Microsoft.SourceLink.GitHub (>= 1.0.0-beta-63102-01)
- YamlDotNet (>= 5.0.1)
-
.NETStandard 2.0
- Microsoft.CSharp (>= 4.5.0)
- Microsoft.Net.Compilers (>= 2.8.2)
- Microsoft.SourceLink.GitHub (>= 1.0.0-beta-63102-01)
- YamlDotNet (>= 5.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
2.1.0 | 5,001 | 11/8/2023 |
2.0.0 | 2,166 | 9/24/2023 |
1.12.0 | 461 | 9/24/2023 |
1.11.0 | 22,283 | 12/30/2021 |
1.10.0 | 1,148 | 1/7/2021 |
1.9.0 | 1,112 | 12/19/2020 |
1.8.0 | 900 | 12/18/2020 |
1.7.0 | 828 | 12/13/2020 |
1.6.0 | 944 | 12/5/2020 |
1.5.0 | 1,023 | 5/17/2020 |
1.4.0 | 1,034 | 4/5/2020 |
1.3.0 | 952 | 3/28/2020 |
1.2.0 | 1,017 | 3/22/2020 |
1.1.0 | 975 | 3/22/2020 |
1.0.0 | 941 | 2/6/2020 |
0.44.0 | 966 | 2/6/2020 |
0.43.0 | 1,055 | 1/19/2020 |
0.42.0 | 985 | 1/19/2020 |
0.41.0 | 979 | 1/19/2020 |
0.40.0 | 2,013 | 8/5/2018 |
0.39.0 | 1,281 | 7/29/2018 |
0.38.0 | 1,258 | 7/27/2018 |
0.37.0 | 1,223 | 7/26/2018 |
0.36.0 | 1,263 | 7/25/2018 |
0.35.0 | 1,231 | 7/24/2018 |
0.34.0 | 1,218 | 7/23/2018 |
0.33.0 | 1,245 | 7/22/2018 |
0.32.0 | 1,277 | 7/17/2018 |
0.31.0 | 1,344 | 7/17/2018 |
0.30.0 | 1,378 | 7/15/2018 |
0.29.0 | 1,327 | 7/14/2018 |
0.28.0 | 1,383 | 7/13/2018 |
0.27.0 | 1,351 | 7/12/2018 |
0.26.0 | 1,385 | 7/11/2018 |
0.25.0 | 1,323 | 7/10/2018 |
0.24.0 | 1,331 | 7/9/2018 |
0.23.0 | 1,402 | 7/8/2018 |
0.22.0 | 1,214 | 7/7/2018 |
0.21.0 | 1,308 | 7/6/2018 |
0.20.0 | 1,307 | 7/5/2018 |
0.19.0 | 1,278 | 7/4/2018 |
0.18.0 | 1,311 | 7/4/2018 |
0.17.0 | 1,344 | 7/2/2018 |
0.16.0 | 1,379 | 7/1/2018 |
0.15.0 | 1,402 | 6/30/2018 |
0.14.0 | 1,339 | 6/29/2018 |
0.13.0 | 1,315 | 6/28/2018 |
0.12.0 | 1,374 | 6/27/2018 |
0.11.0 | 1,312 | 6/26/2018 |
0.10.0 | 1,305 | 6/25/2018 |
0.9.0 | 1,332 | 6/24/2018 |
0.8.0 | 1,370 | 6/23/2018 |
0.7.0 | 1,377 | 6/22/2018 |
0.6.0 | 1,490 | 6/21/2018 |
0.5.0 | 1,361 | 6/20/2018 |
0.4.0 | 1,291 | 6/20/2018 |
0.3.0 | 1,326 | 6/19/2018 |
0.2.0 | 1,379 | 6/19/2018 |
0.1.0 | 1,339 | 6/18/2018 |
Relase notes listing new features and other changes are available at https://github.com/RimuTec/Faker/blob/master/releasenotes.md