Xfty 1.0.0-beta.6
See the version list below for details.
dotnet add package Xfty --version 1.0.0-beta.6
NuGet\Install-Package Xfty -Version 1.0.0-beta.6
<PackageReference Include="Xfty" Version="1.0.0-beta.6" />
<PackageVersion Include="Xfty" Version="1.0.0-beta.6" />
<PackageReference Include="Xfty" />
paket add Xfty --version 1.0.0-beta.6
#r "nuget: Xfty, 1.0.0-beta.6"
#:package Xfty@1.0.0-beta.6
#addin nuget:?package=Xfty&version=1.0.0-beta.6&prerelease
#tool nuget:?package=Xfty&version=1.0.0-beta.6&prerelease
XFTY — Extreme C# Test Data Factory
XFTY is a declarative test data factory for C#.
Instead of manually constructing complete object graphs for every test, you
describe only the values your test actually cares about. XFTY supplies
sensible defaults, automatically creates related records, and either mocks
persistence entirely or actually inserts through a pluggable
IPersistenceGateway — the same Provider definitions serve a pure in-memory
unit test and a real database integration test.
By centralizing test data definitions, XFTY dramatically reduces boilerplate and makes tests more resilient to changing validation rules, required fields, and evolving business logic.
Installation
dotnet add package Xfty
Add whichever opt-in packages you want the same way. Only Xfty itself is
required — everything else is independent and opt-in, grouped below by
what each one actually does:
<table> <thead><tr><th>Package</th><th>What it does</th><th align="center">NuGet</th><th align="center">Tests</th></tr></thead> <tbody> <tr><th colspan="4" align="left">Core</th></tr> <tr><td><strong>Xfty</strong></td><td>Declarative generation, relationships, persistence seam</td><td align="center"><a href="https://www.nuget.org/packages/Xfty/"><img alt="NuGet" src="https://img.shields.io/nuget/v/Xfty.svg"></a></td><td align="center"><a href="https://github.com/nilvon9wo/ExtremeCSharpTestDataFactory/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/nilvon9wo/ExtremeCSharpTestDataFactory/actions/workflows/ci.yml/badge.svg"></a></td></tr> <tr><th colspan="4" align="left">Persistence — <code>IPersistenceGateway</code> implementations</th></tr> <tr><td><a href="Xfty.EntityFrameworkCore/README.md"><strong>Xfty.EntityFrameworkCore</strong></a></td><td>Real, database-backed persistence via EF Core</td><td align="center"><a href="https://www.nuget.org/packages/Xfty.EntityFrameworkCore/"><img alt="NuGet" src="https://img.shields.io/nuget/v/Xfty.EntityFrameworkCore.svg"></a></td><td align="center"><a href="https://github.com/nilvon9wo/ExtremeCSharpTestDataFactory/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/nilvon9wo/ExtremeCSharpTestDataFactory/actions/workflows/ci.yml/badge.svg"></a></td></tr> <tr><td><a href="Xfty.VectorDatabases.Qdrant/README.md"><strong>Xfty<wbr>.VectorDatabases<wbr>.Qdrant</strong></a> 🧪</td><td>PREVIEW: persistence via Qdrant's own client directly</td><td align="center"><a href="https://www.nuget.org/packages/Xfty.VectorDatabases.Qdrant/"><img alt="NuGet" src="https://img.shields.io/nuget/v/Xfty.VectorDatabases.Qdrant.svg"></a></td><td align="center"><a href="https://github.com/nilvon9wo/ExtremeCSharpTestDataFactory/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/nilvon9wo/ExtremeCSharpTestDataFactory/actions/workflows/ci.yml/badge.svg"></a></td></tr> <tr><td><a href="Xfty.VectorDatabases.MicrosoftExtensionsVectorData/README.md"><strong>Xfty<wbr>.VectorDatabases<wbr>.MicrosoftExtensionsVectorData</strong></a> 🧪</td><td>PREVIEW: persistence via any Microsoft.Extensions.VectorData connector</td><td align="center"><a href="https://www.nuget.org/packages/Xfty.VectorDatabases.MicrosoftExtensionsVectorData/"><img alt="NuGet" src="https://img.shields.io/nuget/v/Xfty.VectorDatabases.MicrosoftExtensionsVectorData.svg"></a></td><td align="center"><a href="https://github.com/nilvon9wo/ExtremeCSharpTestDataFactory/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/nilvon9wo/ExtremeCSharpTestDataFactory/actions/workflows/ci.yml/badge.svg"></a></td></tr> <tr><th colspan="4" align="left">Value Generation — bundled <code>IValueExpression</code>s</th></tr> <tr><td><a href="Xfty.Bogus/README.md"><strong>Xfty.Bogus</strong></a></td><td>Realistic fake data - names, emails, addresses, paragraphs</td><td align="center"><a href="https://www.nuget.org/packages/Xfty.Bogus/"><img alt="NuGet" src="https://img.shields.io/nuget/v/Xfty.Bogus.svg"></a></td><td align="center"><a href="https://github.com/nilvon9wo/ExtremeCSharpTestDataFactory/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/nilvon9wo/ExtremeCSharpTestDataFactory/actions/workflows/ci.yml/badge.svg"></a></td></tr> <tr><td><a href="Xfty.VectorDatabases/README.md"><strong>Xfty.VectorDatabases</strong></a></td><td>A random-vector value expression for an embedding field</td><td align="center"><a href="https://www.nuget.org/packages/Xfty.VectorDatabases/"><img alt="NuGet" src="https://img.shields.io/nuget/v/Xfty.VectorDatabases.svg"></a></td><td align="center"><a href="https://github.com/nilvon9wo/ExtremeCSharpTestDataFactory/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/nilvon9wo/ExtremeCSharpTestDataFactory/actions/workflows/ci.yml/badge.svg"></a></td></tr> <tr><th colspan="4" align="left">Auto-Population Pairings</th></tr> <tr><td><a href="Xfty.AutoFixture/README.md"><strong>Xfty.AutoFixture</strong></a></td><td>Pairs XFTY with AutoFixture, both directions</td><td align="center"><a href="https://www.nuget.org/packages/Xfty.AutoFixture/"><img alt="NuGet" src="https://img.shields.io/nuget/v/Xfty.AutoFixture.svg"></a></td><td align="center"><a href="https://github.com/nilvon9wo/ExtremeCSharpTestDataFactory/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/nilvon9wo/ExtremeCSharpTestDataFactory/actions/workflows/ci.yml/badge.svg"></a></td></tr> <tr><td><a href="Xfty.AutoBogus/README.md"><strong>Xfty.AutoBogus</strong></a></td><td>Pairs XFTY with AutoBogus, both directions</td><td align="center"><a href="https://www.nuget.org/packages/Xfty.AutoBogus/"><img alt="NuGet" src="https://img.shields.io/nuget/v/Xfty.AutoBogus.svg"></a></td><td align="center"><a href="https://github.com/nilvon9wo/ExtremeCSharpTestDataFactory/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/nilvon9wo/ExtremeCSharpTestDataFactory/actions/workflows/ci.yml/badge.svg"></a></td></tr> <tr><th colspan="4" align="left">Test-Framework & Language Integration</th></tr> <tr><td><a href="Xfty.Xunit/README.md"><strong>Xfty.Xunit</strong></a></td><td><code>[IsolatesSharedAncestor]</code> xUnit attribute</td><td align="center"><a href="https://www.nuget.org/packages/Xfty.Xunit/"><img alt="NuGet" src="https://img.shields.io/nuget/v/Xfty.Xunit.svg"></a></td><td align="center"><a href="https://github.com/nilvon9wo/ExtremeCSharpTestDataFactory/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/nilvon9wo/ExtremeCSharpTestDataFactory/actions/workflows/ci.yml/badge.svg"></a></td></tr> <tr><td><a href="Xfty.FSharpAsync/README.md"><strong>Xfty.FSharpAsync</strong></a></td><td><code>Async<'T></code> wrappers for F#'s original <code>async { }</code> workflow</td><td align="center"><a href="https://www.nuget.org/packages/Xfty.FSharpAsync/"><img alt="NuGet" src="https://img.shields.io/nuget/v/Xfty.FSharpAsync.svg"></a></td><td align="center"><a href="https://github.com/nilvon9wo/ExtremeCSharpTestDataFactory/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/nilvon9wo/ExtremeCSharpTestDataFactory/actions/workflows/ci.yml/badge.svg"></a></td></tr> </tbody> </table>
🧪 = preview proof-of-concept, versioned 0.x-preview rather than
1.0.0-beta.* - read its own README before depending on it for anything
beyond the question it was built to answer.
Every "Tests" badge above points at the same single CI workflow — this repo builds and tests every package together, not each in isolation, so there's no per-package signal distinct from the whole solution's.
Why XFTY?
As a project grows, so does the amount of code required simply to create valid test data.
A Contact requires an Account. Later, a validation rule requires
additional Account fields. Eventually another related type becomes
mandatory. Over time, hundreds or even thousands of tests can end up
duplicating nearly identical setup code.
XFTY centralizes that knowledge.
Instead of every test knowing how to construct a valid object graph, Providers define that logic once, allowing individual tests to override only the fields they actually care about.
The result is test code that is:
- shorter
- easier to read
- easier to maintain
- more resilient to application changes
Features
Core Generation
- Declarative test data generation, described once per Provider
- Automatic relationship generation — required, optional, shared ancestors, self-referential cycles guarded automatically
- Context-aware values: a field derived from a sibling, a generated
ancestor, or (once the graph exists) a generated child, with a loud error
on a mis-ordered read instead of a silent wrong
null - Per-call relationship control (
IncludeOptional,ExcludeRelationship) without touching a Provider's own definition - Lambda-based field access throughout (
x => x.Field, not a barePropertyInfoornameof(...))
Persistence
- Real persistence through
IPersistenceGateway—Xfty.EntityFrameworkCoreships an EF Core implementation, proven against SQLite and a real Postgres container — or mock Ids with no database touched at all - Deferred and depth-batched insert: build a graph across several calls, then insert it once, in dependency order, across mixed record types
- Suitable for both isolated unit tests and real-database integration tests, with the same Provider definitions
Provider Architecture
- Extensible Provider architecture — implement
IRecordProviderdirectly, or useSimpleRecordProvider<T>when a Provider is nothing but a template - Multi-variant Providers (
FlavouredLookupKey,DiscriminatorLookupKey) — resolve a different Provider for the same type by an arbitrary predicate or field value
Packages & Platform Support
- Optional add-on packages for common conveniences core
Xftydoesn't bundle - none is a dependency of coreXftyitself. See the package table up top for the full roster. - Targets
netstandard2.0/net8.0/net10.0— .NET Framework 4.6.1+, Mono/Xamarin, and older .NET Core all work, not just current .NET
See How XFTY compares for how this stacks up against AutoFixture, Bogus, and similar libraries.
Quick Example
Generate a Contact with sensible defaults:
DefaultProviderLookup lookup = new();
Contact contact = (Contact)await new RecordProvider(typeof(Contact), lookup)
.Supply();
Override only the fields your test actually cares about:
Contact contact = (Contact)await new RecordProvider(typeof(Contact), lookup)
.Put<Contact>(x => x.FirstName, "Alice")
.SetInsertMode(InsertMode.Mock)
.Supply();
Generate complete related object graphs:
Bundle bundle = await new RecordProvider(typeof(Contact), lookup)
.SetInsertMode(InsertMode.Mock)
.SetInclusivity(InsertInclusivity.All)
.SupplyBundle();
Contact contact = (Contact)bundle.GetList<Contact>(x => x.Id)![0];
Account account = (Account)bundle.GetList<Contact>(x => x.AccountId)![0];
Assert.Equal(account.Id, contact.AccountId);
Documentation
Full documentation is in docs/, organised by audience:
| I want to… | Go to |
|---|---|
| Use XFTY to write tests | docs/use/ — start with getting-started |
| Teach XFTY about my own record types | docs/extend/ |
| Work on XFTY itself | docs/contribute/ — architecture |
| Look something up | docs/reference/ — api-cheatsheet, known-issues |
| See what's built / planned | docs/roadmap/ |
Design Philosophy
XFTY was designed around a simple idea:
Tests should describe only what makes them unique.
Everything else should be generated automatically.
Rather than scattering test data throughout an entire codebase, XFTY moves that knowledge into reusable Providers that declaratively describe valid records and their relationships.
The framework then constructs those object graphs automatically, allowing test code to remain focused on the behaviour being tested rather than on setup.
How XFTY Compares
XFTY is not a general-purpose "fill in an object" library like AutoFixture, and it doesn't ship realistic fake-data generators like Bogus. What it does that they don't:
- Generates a related graph — required/optional relationships, shared ancestors deduplicated across many children, self-referential cycles guarded automatically — not one object at a time.
- Has an actual opinion about persistence: the same Provider definitions
run as a pure in-memory
Mockin a unit test, or insert for real throughIPersistenceGatewayin an integration test, with no rewrite. - Resolves a different Provider variant for the same type by a runtime key or predicate, and supports context-aware values — a field derived from a sibling, ancestor, or generated child, with a loud guard against reading one that hasn't been generated yet.
Core Xfty has no built-in realistic fake-data generation (Xfty.Bogus is
an optional add-on for that) and no auto-population by default - every
field a Provider cares about is declared, not guessed. Xfty.AutoFixture
and Xfty.AutoBogus are optional pairings for the fields a Provider
doesn't care about (or for pointing the tool's own generation at a
Provider directly) - neither changes core Xfty's own philosophy. See
docs/reference/comparison.md for the full,
unvarnished comparison against AutoFixture, Bogus, AutoBogus, and NBuilder,
including where XFTY is a worse fit than any of them.
Roadmap
Recently landed (see the CHANGELOG for the full detail, including everything since the 1.0.0-beta.1 tag):
New Packages
Xfty.BogusandXfty.VectorDatabases— optional packages for realistic fake data and vector-embedding fields, without adding either dependency to coreXftyXfty.AutoFixture— pairs XFTY with AutoFixture both directions: pointfixture.Create<T>()at a registeredRecordProvider, and/or let AutoFixture fill in whatever fields a Provider's Master Template left unsetXfty.AutoBogus— the same pairing for AutoBogus (AutoFixture-style auto-population plus Bogus's realistic generators), completing the trifecta: XFTY now pairs with AutoFixture, Bogus, and AutoBogusXfty.Xunit—[IsolatesSharedAncestor], resettingSharedAncestorbefore/after a test class or method automaticallyXfty.FSharpAsync—Async<'T>wrappers for F# code still built onasync { }rather than the newertask { }, which needs no wrapper at all
Core Engine
DiscriminatorLookupKey— resolving a Provider by a field's value- Lambda-based field access across the whole public API
- Typed
RecordProvider<TRecord>/ChildProvider<TChild>wrappers — no cast at theSupply()call site, plus aMasterTemplate<TRecord>-style object-initializer indexer - Real persistence via
IPersistenceGateway(Xfty.EntityFrameworkCore, proven against SQLite and a real Postgres container) - Persistence is fully
asyncend to end — everySupply/SupplyList/SupplyBundlecall, and everything reachable from it, is now genuinelyTask-based, matching how every real backing store (EF Core, a vector database client, a network call) already works underneath
Platform & Reliability
- A full sweep to a from-scratch, idiomatic C# port with no remaining Salesforce-specific surface
- A real, fixed thread-safety issue in
SharedAncestorunder concurrent test execution (xUnit's default; this repo's own suite had opted out) - Core
Xftynow multi-targetsnetstandard2.0;net8.0;net10.0, reaching .NET Framework 4.6.1+/Mono/Xamarin as well as modern .NET, verified via a dedicatednet472test project (netstandard2.0isn't itself runnable)
The full status table — built, not-ported, and open ideas under consideration (embedded/denormalized document relationships) — is docs/roadmap/README.md.
Contributing
Contributions, bug reports, feature requests, and discussions are welcome.
If you would like to contribute:
- Open an issue to discuss proposed changes.
- Keep Provider implementations declarative whenever possible.
- Preserve backwards compatibility unless a compelling reason exists not to.
- Prefer simplicity and readability over additional abstraction.
License
This project is released under the MIT License.
| 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 is compatible. 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 is compatible. 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 | 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. |
-
.NETStandard 2.0
- No dependencies.
-
net10.0
- No dependencies.
-
net8.0
- No dependencies.
NuGet packages (10)
Showing the top 5 NuGet packages that depend on Xfty:
| Package | Downloads |
|---|---|
|
Xfty.EntityFrameworkCore
An IPersisting implementation for XFTY that inserts generated records through Entity Framework Core, instead of mocking them. |
|
|
Xfty.Xunit
xUnit integration for XFTY: [IsolatesSharedAncestor], an attribute for a test class or method that resets SharedAncestor's registry before and after - so a consumer never has to hand-wire a base test class or fixture to keep shared-ancestor state from leaking between tests. |
|
|
Xfty.AutoFixture
Pairs XFTY with AutoFixture: point a Fixture's Create<T>() at a registered RecordProvider instead of AutoFixture's own generation, and/or let AutoFixture fill in whatever fields a Provider's Master Template left unset. |
|
|
Xfty.VectorDatabases
A bundled IValueYielding for XFTY that fills a vector-database record's embedding field with a fixed-length array of random floats - structurally a vector, not a semantically meaningful embedding. |
|
|
Xfty.Bogus
Bundled IValueExpressions for XFTY that produce realistic-looking fake data - names, emails, addresses, paragraphs - by wrapping Bogus, instead of every Provider writing its own. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0-beta.13 | 2,361 | 10/9/2026 |
| 1.0.0-beta.12 | 380 | 9/18/2026 |
| 1.0.0-beta.11 | 126 | 9/10/2026 |
| 1.0.0-beta.10 | 360 | 9/10/2026 |
| 1.0.0-beta.9 | 129 | 9/10/2026 |
| 1.0.0-beta.8 | 118 | 9/10/2026 |
| 1.0.0-beta.7 | 128 | 9/7/2026 |
| 1.0.0-beta.6 | 143 | 9/7/2026 |
| 1.0.0-beta.5 | 121 | 9/6/2026 |
| 1.0.0-beta.3 | 132 | 9/6/2026 |
| 1.0.0-beta.2 | 120 | 9/6/2026 |
| 1.0.0-beta.1 | 131 | 9/6/2026 |