![]() |
VOOZH | about |
dotnet add package Soenneker.Utils.AutoBogus --version 4.0.908
NuGet\Install-Package Soenneker.Utils.AutoBogus -Version 4.0.908
<PackageReference Include="Soenneker.Utils.AutoBogus" Version="4.0.908" />
<PackageVersion Include="Soenneker.Utils.AutoBogus" Version="4.0.908" />Directory.Packages.props
<PackageReference Include="Soenneker.Utils.AutoBogus" />Project file
paket add Soenneker.Utils.AutoBogus --version 4.0.908
#r "nuget: Soenneker.Utils.AutoBogus, 4.0.908"
#:package Soenneker.Utils.AutoBogus@4.0.908
#addin nuget:?package=Soenneker.Utils.AutoBogus&version=4.0.908Install as a Cake Addin
#tool nuget:?package=Soenneker.Utils.AutoBogus&version=4.0.908Install as a Cake Tool
👁 alternate text is missing from this package README image
👁 alternate text is missing from this package README image
👁 alternate text is missing from this package README image
👁 alternate text is missing from this package README image
This project is an automatic creator and populator for the fake data generator Bogus. It's a replacement for the abandoned AutoBogus library.
The goals:
It uses the fastest .NET Reflection cache: soenneker.reflection.cache. Bogus updates are automatically integrated.
.NET 8+ is supported.
dotnet add package Soenneker.Utils.AutoBogus
AutoFaker instance:var optionalConfig = new AutoFakerConfig();
var autoFaker = new AutoFaker(optionalConfig);
Generate<>() on any type you want:var randomWord = autoFaker.Generate<string>();
var dictionary = autoFaker.Generate<Dictionary<int, string>>();
var order = autoFaker.Generate<Order>();
var randomWord = autoFaker.Generate(typeof(string));
autoFaker.Config.Faker = new Faker("de");
autoFaker.Config.RepeatCount = 3;
...
AutoFakerOverrideThis is the recommended way for controlling type customization:
public class OrderOverride : AutoFakerOverride<Order>
{
public override void Generate(AutoFakerOverrideContext context)
{
var target = (context.Instance as Order)!;
target.Id = 123;
// Faker is available
target.Name = context.Faker.Random.Word();
// AutoFaker is also available
target.Customer = context.AutoFaker.Generate<Customer>();
}
}
Then just add AutoFakerOverride to the AutoFaker.Config instance:
autoFaker.Config.Overrides = new List<AutoFakerGeneratorOverride>();
autoFaker.Config.Overrides.Add(new OrderOverride());
AutoFaker<T>This inherits from Bogus.Faker, and can be used to designate rules specific to the AutoFaker instance.
var autoFaker = new AutoFaker<Order>();
autoFaker.RuleFor(x => x.Id, f => f.Random.Number());
var order = autoFaker.Generate();
The base library does not generate interfaces or abstract objects, but these enable you to generate mocks of them:
AutoFaker takes a non-trivial amount of time because of Bogus Faker initialization (almost 1ms). It's recommended that a single instance be used if possible.AutoFaker.GenerateStatic<T>() is also available, but should be avoided (as it creates a new AutoFaker/Faker on each call).AutoFaker| Method | Mean | Error | StdDev |
|---|---|---|---|
| Generate_int | 79.40 ns | 0.635 ns | 0.563 ns |
| Generate_string | 241.35 ns | 3.553 ns | 3.324 ns |
| Generate_complex | 6,782.34 ns | 43.811 ns | 38.837 ns |
AutoFaker<T>| Method | Mean | Error | StdDev |
|---|---|---|---|
| Generate_string | 283.6 ns | 3.28 ns | 3.07 ns |
| Generate_complex | 8,504.0 ns | 76.58 ns | 67.89 ns |
| Method | Mean | Error | StdDev |
|---|---|---|---|
| Generate_int | 1.17 ms | 0.033 ms | 0.026 ms |
| Generate_complex | 10.91 ms | 0.181 ms | 0.236 ms |
| Method | Mean | Error | StdDev |
|---|---|---|---|
| Bogus_int | 19.70 ns | 0.176 ns | 0.165 ns |
| Bogus_string | 171.75 ns | 2.763 ns | 2.585 ns |
| Bogus_ctor | 730,669.06 ns | 8,246.622 ns | 7,310.416 ns |
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 is compatible. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 5 NuGet packages that depend on Soenneker.Utils.AutoBogus:
| Package | Downloads |
|---|---|
|
Soenneker.Tests.Unit
A base test providing faker and autofaker capabilities |
|
|
Soenneker.Fixtures.Unit
A base xUnit fixture providing injectable log output, DI mechanisms like IServiceCollection and ServiceProvider, and AutoFaker/Faker for generating test data. |
|
|
Soenneker.AutoFaker.Overrides.IdNamePair
An AutoFaker (AutoBogus) override for the DTO IdNamePair |
|
|
Soenneker.AutoFaker.Overrides.Documents.Document
An AutoFaker (AutoBogus) override for the base Document object |
|
|
Soenneker.TestHosts.Unit
A lightweight host for dependency-driven unit tests. |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.0.908 | 10,629 | 6/15/2026 |
| 4.0.907 | 35,387 | 6/10/2026 |
| 4.0.906 | 5,747 | 6/9/2026 |
| 4.0.905 | 35,426 | 6/6/2026 |
| 4.0.904 | 548 | 6/6/2026 |
| 4.0.903 | 8,677 | 6/5/2026 |
| 4.0.901 | 905 | 6/5/2026 |
| 4.0.899 | 36,555 | 6/1/2026 |
| 4.0.898 | 154 | 6/1/2026 |
| 4.0.897 | 58,915 | 5/13/2026 |
| 4.0.896 | 1,089 | 5/12/2026 |
| 4.0.895 | 89,173 | 4/23/2026 |
| 4.0.894 | 1,619 | 4/22/2026 |
| 4.0.893 | 896 | 4/22/2026 |
| 4.0.892 | 1,577 | 4/22/2026 |
| 4.0.891 | 698 | 4/22/2026 |
| 4.0.890 | 216 | 4/22/2026 |
| 4.0.889 | 46,662 | 4/14/2026 |
| 4.0.888 | 10,872 | 4/14/2026 |
| 4.0.887 | 17,771 | 4/8/2026 |
cleanup