Bogus 20.0.1
Prefix ReservedSee the version list below for details.
dotnet add package Bogus --version 20.0.1
NuGet\Install-Package Bogus -Version 20.0.1
<PackageReference Include="Bogus" Version="20.0.1" />
<PackageVersion Include="Bogus" Version="20.0.1" />
<PackageReference Include="Bogus" />
paket add Bogus --version 20.0.1
#r "nuget: Bogus, 20.0.1"
#addin nuget:?package=Bogus&version=20.0.1
#tool nuget:?package=Bogus&version=20.0.1
The Great C# Example
public enum Gender
{
Male,
Female
}
//Set the randomzier seed if you wish to generate repeatable data sets.
Randomizer.Seed = new Random(8675309);
var fruit = new[] { "apple", "banana", "orange", "strawberry", "kiwi" };
var orderIds = 0;
var testOrders = new Faker<Order>()
//Ensure all properties have rules. By default, StrictMode is false
//Set a global policy by using Faker.DefaultStrictMode
.StrictMode(true)
//OrderId is deterministic
.RuleFor(o => o.OrderId, f => orderIds++)
//Pick some fruit from a basket
.RuleFor(o => o.Item, f => f.PickRandom(fruit))
//A random quantity from 1 to 10
.RuleFor(o => o.Quantity, f => f.Random.Number(1, 10));
var userIds = 0;
var testUsers = new Faker<User>()
//Optional: Call for objects that have complex initialization
.CustomInstantiator(f => new User(userIds++, f.Random.Replace("###-##-####")))
//Basic rules using built-in generators
.RuleFor(u => u.FirstName, f => f.Name.FirstName())
.RuleFor(u => u.LastName, f => f.Name.LastName())
.RuleFor(u => u.Avatar, f => f.Internet.Avatar())
.RuleFor(u => u.UserName, (f, u) => f.Internet.UserName(u.FirstName, u.LastName))
.RuleFor(u => u.Email, (f, u) => f.Internet.Email(u.FirstName, u.LastName))
.RuleFor(u => u.SomethingUnique, f => $"Value {f.UniqueIndex}")
.RuleFor(u => u.SomeGuid, Guid.NewGuid)
//Use an enum outside scope.
.RuleFor(u => u.Gender, f => f.PickRandom<Gender>())
//Use a method outside scope.
.RuleFor(u => u.CartId, f => Guid.NewGuid())
//Compound property with context, use the first/last name properties
.RuleFor(u => u.FullName, (f, u) => u.FirstName + " " + u.LastName)
//And composability of a complex collection.
.RuleFor(u => u.Orders, f => testOrders.Generate(3).ToList())
//Optional: After all rules are applied finish with the following action
.FinishWith((f, u) =>
{
Console.WriteLine("User Created! Id={0}", u.Id);
});
var user = testUsers.Generate();
Console.WriteLine(user.DumpAsJson());
/* OUTPUT:
User Created! Id=0
*
{
"Id": 0,
"FirstName": "Audrey",
"LastName": "Spencer",
"FullName": "Audrey Spencer",
"UserName": "Audrey_Spencer72",
"Email": "Audrey82@gmail.com",
"Avatar": "https://s3.amazonaws.com/uifaces/faces/twitter/itstotallyamy/128.jpg",
"CartId": "863f9462-5b88-471f-b833-991d68db8c93",
"SSN": "923-88-4231",
"Gender": 0,
"Orders": [
{
"OrderId": 0,
"Item": "orange",
"Quantity": 8
},
{
"OrderId": 1,
"Item": "banana",
"Quantity": 2
},
{
"OrderId": 2,
"Item": "kiwi",
"Quantity": 9
}
]
} */
Click here for F# and VB.NET examples!
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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.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 | net40 is compatible. net403 was computed. net45 was computed. net451 was computed. net452 was computed. net46 was computed. net461 was computed. net462 was computed. 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.0
- No dependencies.
-
.NETStandard 2.0
- No dependencies.
NuGet packages (172)
Showing the top 5 NuGet packages that depend on Bogus:
Package | Downloads |
---|---|
AutoBogus
A C# library complementing the Bogus generator by adding auto creation and population capabilities. |
|
Soenneker.Utils.AutoBogus
The .NET Bogus autogenerator |
|
FunFair.Test.Common
FunFair Common Test Infrastructure for building xUnit tests on top of. |
|
Reo.Core.Testing
Package Description |
|
NodaTime.Bogus
Add support for NodaTime https://nodatime.org/ to Bogus https://github.com/bchavez/Bogus |
GitHub repositories (134)
Showing the top 20 popular GitHub repositories that depend on Bogus:
Repository | Stars |
---|---|
cefsharp/CefSharp
.NET (WPF and Windows Forms) bindings for the Chromium Embedded Framework
|
|
FluentValidation/FluentValidation
A popular .NET validation library for building strongly-typed validation rules.
|
|
elsa-workflows/elsa-core
A .NET workflows library
|
|
graphql-dotnet/graphql-dotnet
GraphQL for .NET
|
|
kurrent-io/KurrentDB
KurrentDB is a database that's engineered for modern software applications and event-driven architectures. Its event-native design simplifies data modeling and preserves data integrity while the integrated streaming engine solves distributed messaging challenges and ensures data consistency.
|
|
ServiceStack/ServiceStack
Thoughtfully architected, obscenely fast, thoroughly enjoyable web services for all
|
|
FastEndpoints/FastEndpoints
A light-weight REST API development framework for ASP.NET 8 and newer.
|
|
umbraco/Umbraco-CMS
Umbraco is a free and open source .NET content management system helping you deliver delightful digital experiences.
|
|
fluentassertions/fluentassertions
A very extensive set of extension methods that allow you to more naturally specify the expected outcome of a TDD or BDD-style unit tests. Targets .NET Framework 4.7, as well as .NET Core 2.1, .NET Core 3.0, .NET 6, .NET Standard 2.0 and 2.1. Supports the unit test frameworks MSTest2, NUnit3, XUnit2, MSpec, and NSpec3.
|
|
elastic/elasticsearch-net
This strongly-typed, client library enables working with Elasticsearch. It is the official client maintained and supported by Elastic.
|
|
skoruba/IdentityServer4.Admin
The administration for the IdentityServer4 and Asp.Net Core Identity
|
|
dotnet/samples
Sample code referenced by the .NET documentation
|
|
oskardudycz/EventSourcing.NetCore
Examples and Tutorials of Event Sourcing in .NET
|
|
JasperFx/marten
.NET Transactional Document DB and Event Store on PostgreSQL
|
|
chromelyapps/Chromely
Build Cross Platform HTML Desktop Apps on .NET using native GUI, HTML5, JavaScript, CSS, Owin, AspNetCore (MVC, RazorPages, Blazor)
|
|
vietnam-devs/coolstore-microservices
A full-stack .NET microservices build on Dapr and Tye
|
|
evolutionary-architecture/evolutionary-architecture-by-example
Navigate the complex landscape of .NET software architecture with our step-by-step, story-like guide. Unpack the interplay between modular monoliths, microservices, domain-driven design, and various architectural patterns. Go beyond the one-size-fits-all solutions and understand how to blend these approaches based on your unique needs.
|
|
SubnauticaNitrox/Nitrox
An open-source, multiplayer modification for the game Subnautica.
|
|
reactivemarbles/DynamicData
Reactive collections based on Rx.Net
|
|
Windows-XAML/Template10
Making Windows 10 apps great again
|
Version | Downloads | Last Updated |
---|---|---|
35.6.3 | 1,426,307 | 4/12/2025 |
35.6.2 | 2,098,639 | 2/21/2025 |
35.6.1 | 8,841,840 | 9/2/2024 |
35.6.0 | 2,446,266 | 7/19/2024 |
35.5.1 | 4,649,294 | 4/28/2024 |
35.5.0 | 3,249,129 | 3/9/2024 |
35.4.1 | 424,526 | 3/2/2024 |
35.4.0 | 3,299,206 | 1/14/2024 |
35.3.2 | 9,756 | 1/14/2024 |
35.3.1 | 18,321 | 1/13/2024 |
35.3.0 | 676,557 | 1/1/2024 |
35.2.0 | 163,065 | 12/26/2023 |
35.0.1 | 600,096 | 12/12/2023 |
34.0.2 | 34,450,799 | 3/27/2022 |
34.0.1 | 5,077,081 | 11/23/2021 |
33.1.1 | 3,262,010 | 8/29/2021 |
33.0.2 | 7,821,911 | 2/21/2021 |
33.0.1 | 406,715 | 2/7/2021 |
32.1.1 | 224,366 | 1/31/2021 |
32.0.2 | 2,217,980 | 12/12/2020 |
32.0.1 | 757,660 | 11/28/2020 |
31.0.3 | 13,255,089 | 10/4/2020 |
30.0.4 | 851,901 | 8/15/2020 |
30.0.1-beta-4 | 18,868 | 7/24/2020 |
30.0.1-beta-3 | 15,806 | 6/30/2020 |
30.0.1-beta-2 | 5,470 | 6/21/2020 |
30.0.1-beta-1 | 8,210 | 6/15/2020 |
29.0.2 | 5,158,293 | 4/11/2020 |
29.0.1 | 1,679,106 | 2/10/2020 |
28.4.4 | 2,552,746 | 12/10/2019 |
28.4.3 | 332,368 | 12/4/2019 |
28.4.2 | 23,777 | 11/30/2019 |
28.4.1 | 1,248,735 | 10/15/2019 |
28.3.2 | 262,257 | 10/4/2019 |
28.3.1 | 181,270 | 9/21/2019 |
28.2.1 | 619,838 | 9/10/2019 |
28.1.1 | 7,481 | 9/10/2019 |
28.0.3 | 264,400 | 8/28/2019 |
28.0.2 | 1,296,979 | 7/7/2019 |
28.0.1 | 60,602 | 7/2/2019 |
27.0.1 | 1,247,247 | 5/2/2019 |
26.0.2 | 461,145 | 3/22/2019 |
26.0.1 | 795,808 | 2/26/2019 |
25.0.4 | 538,880 | 1/18/2019 |
25.0.3 | 129,041 | 1/6/2019 |
25.0.2 | 242,614 | 12/11/2018 |
25.0.1 | 122,940 | 11/27/2018 |
24.3.1 | 208,448 | 11/3/2018 |
24.3.0 | 527,231 | 10/2/2018 |
24.2.0 | 57,219 | 9/27/2018 |
23.0.2 | 195,277 | 8/13/2018 |
22.3.2 | 167,699 | 7/18/2018 |
22.3.1 | 121,208 | 7/5/2018 |
22.2.1 | 29,752 | 6/29/2018 |
22.1.4 | 33,750 | 6/26/2018 |
22.1.3 | 68,286 | 6/14/2018 |
22.1.2 | 340,015 | 5/29/2018 |
22.1.1 | 38,466 | 5/21/2018 |
22.0.9 | 6,772 | 5/17/2018 |
22.0.8 | 418,012 | 4/10/2018 |
22.0.7 | 58,233 | 4/1/2018 |
22.0.6 | 10,084 | 3/29/2018 |
22.0.5 | 151,232 | 3/3/2018 |
22.0.3 | 19,875 | 2/27/2018 |
22.0.2 | 178,998 | 1/6/2018 |
22.0.1 | 57,100 | 12/23/2017 |
21.0.5 | 13,207 | 12/16/2017 |
21.0.4 | 32,805 | 12/13/2017 |
21.0.2 | 20,832 | 12/8/2017 |
20.0.2 | 138,743 | 11/6/2017 |
20.0.1 | 8,502 | 11/5/2017 |
19.0.2 | 57,261 | 11/1/2017 |
18.0.2 | 140,985 | 9/14/2017 |
18.0.1 | 15,956 | 9/13/2017 |
17.0.1 | 80,342 | 8/25/2017 |
16.0.3 | 14,683 | 8/24/2017 |
16.0.2 | 7,905 | 8/23/2017 |
15.0.7 | 8,848 | 8/21/2017 |
15.0.6 | 30,855 | 8/3/2017 |
15.0.5 | 8,652 | 7/28/2017 |
15.0.3 | 258,293 | 5/7/2017 |
15.0.1 | 36,918 | 4/11/2017 |
12.0.1 | 15,939 | 3/27/2017 |
11.0.5 | 14,393 | 3/20/2017 |
11.0.4 | 33,281 | 3/15/2017 |
11.0.3 | 10,581 | 3/13/2017 |
11.0.2 | 57,014 | 2/23/2017 |
11.0.1 | 5,165 | 2/21/2017 |
10.0.1 | 5,136 | 2/18/2017 |
9.0.2 | 25,915 | 1/19/2017 |
9.0.1 | 4,624 | 1/18/2017 |
8.0.4 | 4,990 | 1/17/2017 |
8.0.3 | 39,972 | 12/20/2016 |
8.0.2 | 13,111 | 12/7/2016 |
8.0.1 | 15,309 | 11/25/2016 |
8.0.1-beta-1 | 23,792 | 10/22/2016 |
7.1.7 | 82,090 | 10/11/2016 |
7.1.6 | 45,295 | 8/8/2016 |
7.1.5 | 9,058 | 7/27/2016 |
7.1.4 | 7,955 | 7/7/2016 |
7.1.3 | 53,064 | 6/28/2016 |
7.1.3-beta-1 | 4,090 | 5/20/2016 |
7.1.2 | 44,519 | 5/16/2016 |
7.1.2-beta-1 | 4,145 | 5/16/2016 |
7.1.1 | 4,542 | 5/15/2016 |
7.1.1-beta-1 | 3,993 | 5/15/2016 |
6.1.1 | 10,281 | 3/30/2016 |
6.1.1-beta-1 | 4,255 | 3/29/2016 |
5.1.1-beta-3 | 4,147 | 3/23/2016 |
5.1.1-beta-2 | 4,494 | 3/22/2016 |
5.1.1-beta-1 | 4,207 | 3/21/2016 |
5.0.1 | 20,581 | 2/25/2016 |
5.0.1-beta-2 | 4,326 | 2/25/2016 |
4.0.1 | 4,828 | 2/16/2016 |
4.0.1-beta-1 | 4,048 | 2/16/2016 |
3.0.6 | 6,592 | 1/21/2016 |
3.0.6-beta-1 | 4,057 | 1/21/2016 |
3.0.5 | 8,811 | 1/21/2016 |
3.0.5-beta-4 | 3,964 | 1/20/2016 |
3.0.5-beta-3 | 4,031 | 1/18/2016 |
3.0.5-beta-2 | 5,214 | 1/12/2016 |
3.0.4 | 5,413 | 12/10/2015 |
3.0.3 | 4,443 | 12/9/2015 |
3.0.2 | 4,623 | 11/24/2015 |
3.0.1 | 5,023 | 10/22/2015 |
3.0.0.3 | 5,349 | 7/21/2015 |
3.0.0.2 | 6,441 | 7/12/2015 |
3.0.0.1 | 25,205 | 7/12/2015 |
2.1.5.2 | 4,913 | 6/22/2015 |
2.1.5.1 | 4,498 | 6/11/2015 |
2.1.4.2 | 4,545 | 6/11/2015 |
2.1.4.1 | 4,533 | 6/10/2015 |
2.1.4 | 73,900 | 6/9/2015 |
## v20.0.1
* Added `Faker<T>.Clone()`: Clones internal state of a `Faker<T>` and allows for complex faking scenarios and rule combinations.
* Added `Faker<T>.UseSeed(n)`: Allows you to specify a localized seed value on a `Faker<T>` instead of a global static `Randomizer.Seed`.
* Stronger `Seed` determinism for multi-threaded scenarios.
## v19.0.2
* Fixed #99: Possible threading issue that can cause `System.ArgumentException`.
## v19.0.1
* Using new BSON binary data format for locales.
* Removed dependency on Newtonsoft.Json!
* Locale Updates -
* `fr`: new street address prefixes.
* `fa`: new street addresses.
* `pl`: removed 2008 value from city.
* `en`: new gender first names
* New Dutch (Belgium) `nl_BE` locale.
* New Romanian `ro` locale.
* Added `f.Finance.RoutingNumber` - Generates an ABA routing number with valid check digit.
* Added `Faker.GenerateForever` that returns `IEnumerable<T>` with unlimited generated items when iterated over.
* Added United Kingdom extension method to generate bank ShortCodes on `f.Finance.ShortCode()`.
* Re-ordered adjective and buzz in the `f.Company.Bs` for a correct gramatics.
* Added `f.Address.Direction`. Generates cardinal or ordinal directions.
* Added `f.Address.CardinalDirection`. Generates "North", "South", etc.
* Added `f.Address.OrdinalDirection`. Generates "Northeast", "Southwest", etc.
## v18.0.2
* Issue 86: Removed diacritic mark/accents (á, í, ó, ú, etc) from generated email addresses and user names.
* Added `string.RemoveDiacritics` helper method.
## v18.0.1
* Fixed bug in Finland's `f.Person.Henkilötunnus` personal identity code generator that sometimes produced 11 characters.
* Added `f.Finance.Ethereum`. Generate an Ethereum address.
* Added `f.Finance.CreditCardCvv`. Generate a random credit card CVV number.
* Improved `f.Finance.CreditCardNumber`. Generate a random credit card number.
* Added `f.Random.Hexadecimal`. Generates a random hexadecimal string.
* Added `f.System.DirectoryPath`. Generates a random directory path.
* Added `f.System.FilePath`. Generates a random file path.
* Added `f.Date.Soon`. Generates a date and time that will happen soon.
* Added `f.Random.ArrayElements`. Gets a random subset of an array.
* Added `f.Random.ListItems`. Gets a random subset of a list.
* Added `f.Company.Cnpj` extension method for Brazil. Generates Brazilian company document.
* Improved `f.PhoneNumbers`. More realistic US phone numbers.
* Improved `f.Address.Latitude/Longitude` with min and max parameters.
* Minimum for `f.Commerce.Price` is now $1.00 (not zero).
* Reduced assembly size by removing redundant locale data.
* Locale updates:
* `en_AU` - Update Australian postcode ranges.
* `en_IND` - Indian postcodes are always numeric.
* `ru` - Word corrections.
Full History Here: https://github.com/bchavez/Bogus/blob/master/HISTORY.md