Examples

Project management

Six levels, three rank scopes, workspace-wide tickets and sibling branches.

A workspace can contain many nested boards and cards, but ticket numbers may need to span the whole workspace. This example combines local ranks with that wider counter and shows how to return to cards to add a sibling branch.

Workspace → Project → Board → Column → Card → ChecklistItem, with Comment as a sibling branch of the checklist. Ranks restart per parent, but ticket numbers span the whole workspace. Source: tests/Zeeq.Biome.Tests/ProjectManagement.

Every scenario exists twice in one ProjectManagementTests partial class: ProjectManagementTests.WithBiome.cs uses Biome, and ProjectManagementTests.Typical.cs sets up the same entities by hand with identical assertions. Read them side by side to see what Biome removes.

Rank scopes and a workspace ticket counter

ProjectManagement/Domain.cs
// Each column starts at "a" and keeps its count when a test returns to it.
internal static readonly Sequence<string> CardRanks = Sequence
    .Of("a", r => r + "a")
    .PerParent();

// Continue ticket numbers across projects, boards, and columns in the same workspace.
internal static readonly Sequence<int> Tickets = Sequence.Of(1, n => n + 1).Per<Workspace>();

internal static readonly ChildBlueprint<ProjectSeed, Column, Card> Card = Blueprint
    .ChildOf<ProjectSeed, Column, Card>(
        (column, ctx) =>
            new()
            {
                Column = column,
                Workspace = ctx.Ancestor<Workspace>(), // Use the workspace that owns this column.
                DueAt = ctx.FromNow(TimeSpan.FromDays(1)),
            }
    )
    // Derive the title after the two counters assign their values.
    .Derive(c => c.Rank, CardRanks)
    .Derive(c => c.Ticket, Tickets)
    .Derive(c => c.Title, (c, _) => $"Ticket {c.Ticket}");
ctx.Ancestor<Workspace>() follows the card's column through its board and project to the workspace. The chain must already contain that workspace.

A portfolio, then sibling comments

Each count multiplies the previous output. After the deepest leaves, .Under(cards) jumps back to attach comments as siblings of the checklist.

await biome
    // Counts apply per parent, so two workspaces produce 24 cards and 96 checklist items.
    .AddWorkspaces(out var workspaces, 2)
    .AddProjects(out _, 2)
    .AddBoards(out _, 1)
    .AddColumns(out var columns, 2)
    .AddCards(out var cards, 3)
    .AddChecklistItems(out var checklist, 4)
    // Return to the cards so comments and checklist items share the same parents.
    .Under(cards)
    .AddComments(out var comments, 2)
    .BuildAsync();
The hand-written setup has three nested loops, three rank counters, and a ticket dictionary. Moving those rules into blueprints gives later tests the same numbering behavior in one fluent chain.

The real test checks that tenancy flows through every level (checklist[95].Workspace == workspaces[1]), that ranks restart (columns[2].Rank == "a", cards[3].Rank == "a"), and that all 24 × 2 comments share one frozen timestamp.

Local ranks skip explicit values; tickets span columns

ProjectManagementTests.WithBiome.cs
await biome
    .AddWorkspace(out _)
    .AddProject(out _)
    .AddBoard(out _)
    .AddColumns(out var columns, 2)
    .AddCards(
        out var cards,
        Cards.Blocked + Cards.Urgent,
        // Reserve "a" before deriving the first card's rank in each column.
        c =>
        {
            c.Rank = "a";
            c.Title = "Regression";
        }
    )
    .AddChecklistItems(out _, 2)
    // Resume one column's rank and the encompassing workspace's ticket sequence.
    .Under(columns[0])
    .AddCard(out var next)
    .BuildAsync();

// cards[0].Rank == "aa"; cards[2].Ticket == 3
// next.Rank == "aaa"; next.Ticket == 5; next.Title == "Ticket 5"
Cards.Blocked + Cards.Urgent is one card with both traits, while the second customizer is the second card in each column. Four cards total, each column ranking its own.

A ready-made six-level branch, with a transient comment

ProjectManagementTests.WithBiome.cs
var time = new FakeTimeProvider(new DateTimeOffset(2026, 10, 11, 12, 0, 0, TimeSpan.Zero));
var biome = TestBiome.Start(out _, store, time);
biome.AddReadyChecklist(out var leaf); // Build the six-level path to a checklist item.

time.Advance(TimeSpan.FromHours(2));
await biome
    // Reuse the card and keep its draft comment available in memory.
    .Under(leaf.Card)
    .AddComment(out var preview)
    .Transient()
    .BuildAsync();

// store.Entities.Count == 6; no Comment saved
// preview.CreatedAt == time.GetUtcNow().AddHours(-1)