Skip to content

Add ITestDataBuilder<TObject> interface, missing after migration from NTestDataBuilder #47

Closed
@dennisroche

Description

@dennisroche

I found this interface useful to create a extension method for seeding a DB context directly with builders.

e.g.

public static async Task<T> SaveAsync<T>(this IDbContext context, ITestDataBuilder<T> builder)
    where T : class
{
    var entity = builder.Build();
    context.Set<T>().Add(entity);
    await context.SaveAsync();
    return entity;
}

It was in NTestDataBuilder, however was removed for some reason in TestStack.Dossier. The change wasn't listed in BREAKING_CHANGES.md

I'll raise a PR for this soon.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions