Stop Tedious Test Data Setup: Introducing vTMockDataForge for Effortless C# Object and List Mocking


As developers, we’ve all been there-facing a complex object model that needs to be filled with realistic data for testing, demos, or seeding a database. And what does that usually mean?

  • Long hours crafting verbose object initializers
  • Boilerplate code that clutters your test suites
  • Logic hidden beneath layers of mock data setup
You’ve seen code like this far too often:
// The Old Way: Manual Object Initialization (50+ lines!)
var company = new Company
{
    CompanyId = "C001",
    Name = "Company1",
    Industry = "Industry1",
    Address = new Address
    {
        AddressId = "A001",
        StreetAddress = "Street1",
        City = "City1",
        State = "State1",
        PostalCode = "PostalCode1",
        Country = "Country1"
    },
    Employees = new List<Employee>
    {
        new Employee
        {
            EmployeeId = "E001",
            FirstName = "FirstName1",
            // ...
        }
    }
    // And so on… (50+ lines!)
};	

Now imagine replacing all that with:

var company = new Company().MockWithFakeData();

That’s not magic — it’s vTMockDataForge.


Meet vTMockDataForge

vTMockDataForge is a lightweight, developer-friendly .NET library that simplifies C# object mocking to a beautiful one-liner — with realistic, contextual fake data generated intelligently.

Whether you’re writing unit tests, seeding a database, preparing a demo, or stress-testing an API — this tool will be your new best friend.


Key Features

One-Liner Initialization

var customer = new Customer().MockWithFakeData();
var order = new Order().MockWithFakeData();

Mock Collections in Seconds

var companies = new List<Company>().MockWithFakeData(count: 5);

var orders = new List<Order>().MockWithFakeData(count: 3, builder =>
{
    builder.For(o => o.OrderDate, g => g.Date.Recent(30))
           .For(o => o.Status, g => g.PickAnyValue.Get(["Pending", "Processing", "Shipped"]));
});

Fluent, Custom Configuration

var company = new Company().MockWithFakeData(builder =>
{
    builder.For(c => c.EmployeeCount, g => g.Number.Integer(10, 1000))
           .For(c => c.CompanyId, g => $"COMP-{Guid.NewGuid():N}"[..8])
           .For(c => c.Name, g => g.Company.Name())
           .For(c => c.Email, g => g.Email.BusinessEmail());
});

Pick any value from a fixed list:

builder.For(e => e.Department, g => g.PickAnyValue.Get(["Sales", "HR", "IT"]));

Use regex to generate pattern-based values:

.For(e => e.Passport, g => g.RegexValueGenerator.Generate(@"^[A-Z][1-9]\d\s?\d{4}[1-9]$"))

Perfect for enums, formatted codes, and domain-specific rules.


Realistic Mock Data Categories

CategoryExamples
PeopleNames, emails, phone numbers
BusinessCompanies, job titles, salaries
LocationCities, addresses, postal codes
TemporalDates, timestamps, durations
FinancialRevenues, currencies, salaries
CustomRegex patterns, enums, codes

Handles Complex Object Graphs Gracefully

var company = new Company().MockWithFakeData(builder =>
{
    builder.For(c => c.Address, g => new Address().MockWithFakeData())
           .For(c => c.Employees, g => new List<Employee>().MockWithFakeData(emp =>
           {
               emp.For(e => e.FirstName, g => g.Name.FirstName())
                  .For(e => e.Address, g => new Address().MockWithFakeData());
           }, minItems: 2, maxItems: 5));
});

Use Cases

Unit Testing

var activeUsers = new List<User>().MockWithFakeData(count: 10, builder =>
{
    builder.For(u => u.IsActive, g => true);
});

API & Performance Testing

var orders = new List<Order>().MockWithFakeData(count: 500);

Demos & Presentations

var sampleCompanies = new List<Company>().MockWithFakeData(count: 20, builder =>
{
    builder.For(c => c.Industry, g => g.PickAnyValue.Get(["Tech", "Finance", "Retail"]));
});

Before vs After

Without vTMockDataForgeWith vTMockDataForge
50+ lines of setup1–5 lines of clean config
Verbose and hard to maintainFluent and expressive
Repetitive boilerplateAuto-generated smart defaults
Time-consuming setupInstant, contextual data

Get Started in 2 Minutes

Install via NuGet:

dotnet add package vTMockDataForge

Or via Package Manager:

Install-Package vTMockDataForge

Start Mocking:

using vT.MockDataForge;

var obj = new MyClass().MockWithFakeData();
var list = new List<MyClass>().MockWithFakeData(count: 10);

Why Developers Love vT.MockDataForge

  • Intuitive: Learn in minutes
  • Powerful: Handles deep object graphs
  • Flexible: Full control over values
  • Ready for production: Tested in real-world projects

Perfect For:

  • Unit Testing
  • Integration Testing
  • API Testing
  • Demo Data
  • Database Seeding
  • Load/Performance Testing

Say Goodbye to Tedious Mocking

With vTMockDataForge, your C# test data setup becomes effortless, expressive, and clean. Less boilerplate. More brilliance.

Made with ❤️ for the .NET Community.
Happy Coding!

Please follow and like us:
0

Leave a Reply

Your email address will not be published. Required fields are marked *