Cette page est affichée en anglais. Une traduction française est en cours.
ConfigsJul 13, 2026·2 min de lecture

Bogus — Realistic Fake Data Generator for .NET

A simple and powerful fake data generator for C#, F#, and VB.NET, based on and compatible with the popular faker.js library.

Prêt pour agents

Installation agent prête

Cet actif peut être installé après choix du runtime, vérification du plan et exécution de la commande adaptée.

Native · 98/100Policy : autoriser
Surface agent
Tout agent MCP/CLI
Type
Skill
Installation
Single
Confiance
Confiance : Established
Point d'entrée
Bogus Overview
Commande d'installation directe
npx -y tokrepo@latest install a9aad544-7e94-11f1-9bc6-00163e2b0d79 --target codex

À exécuter après confirmation du plan en dry-run.

Introduction

Bogus is a .NET port of the popular faker.js library, providing a fluent API for generating realistic fake data. It is widely used for seeding databases, populating test fixtures, and prototyping applications without relying on production data.

What Bogus Does

  • Generates fake data across 50+ categories including names, addresses, finance, and lorem text
  • Provides a strongly-typed fluent API for defining generation rules per property
  • Supports 40+ locales for internationalized fake data
  • Produces deterministic output with configurable seed values for reproducible tests
  • Works with records, classes, and anonymous types in C#, F#, and VB.NET

Architecture Overview

Bogus uses a fluent builder pattern where Faker<T> maps generation rules to properties via lambda expressions. Under the hood, each data category (Name, Address, Commerce, etc.) is a dataset class loaded from locale-specific JSON files. A Mersenne Twister PRNG with optional seed ensures reproducibility.

Self-Hosting & Configuration

  • Install via NuGet: dotnet add package Bogus
  • No external services or configuration required — it is a pure library
  • Set a seed with new Faker<T>().UseSeed(1234) for deterministic output
  • Use Faker.GlobalUniqueIndex to track unique values across instances
  • Add locale-specific data with new Faker<T>("de") or any supported locale code

Key Features

  • Fluent API with full IntelliSense support in Visual Studio and Rider
  • Over 50 built-in data generators (Phone, Company, Vehicle, Hacker, etc.)
  • Supports complex object graphs with nested fakers
  • Lightweight with no external dependencies
  • Extensively tested with high community adoption across the .NET ecosystem

Comparison with Similar Tools

  • Faker.js — The JavaScript original; Bogus is its .NET port with idiomatic C# API
  • AutoFixture — Focuses on anonymous test data; Bogus produces human-readable realistic data
  • NBuilder — Object builder for tests; less focus on realistic data categories
  • GenFu — Simpler .NET fake data library; Bogus has more categories and locales

FAQ

Q: Can Bogus generate unique values? A: Yes, use the .UniqueIndex property or the f.IndexFaker to ensure uniqueness across generated instances.

Q: Does Bogus work with Entity Framework? A: Yes, it is commonly used in EF Core seed methods to populate databases with test data.

Q: How do I generate a list of fake objects? A: Call faker.Generate(100) to create a list of 100 fake objects in one call.

Q: Is Bogus suitable for production use? A: It is designed for testing, development, and demos — not for generating production data.

Sources

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires