Class ProtoDataObjectBuilder<T>

Namespace
ProtoTest.Data
Assembly
ProtoTest.Data.dll

Builds one instance while keeping scenario-relevant values explicit.

public sealed class ProtoDataObjectBuilder<T>

Type Parameters

T
Inheritance
ProtoDataObjectBuilder<T>
Inherited Members
Extension Methods

Methods

Build()

Constructs the configured object and records value provenance in ProtoTrace.

public T Build()

Returns

T

BuildMany(int, Action<ProtoDataObjectBuilder<T>, int>?)

Builds multiple independently resolved instances with deterministic unique sequences.

public IReadOnlyList<T> BuildMany(int count, Action<ProtoDataObjectBuilder<T>, int>? configure = null)

Parameters

count int
configure Action<ProtoDataObjectBuilder<T>, int>

Returns

IReadOnlyList<T>

CreateAsync(CancellationToken)

Builds the value and places it into the application using its registered provisioner.

public ValueTask<T> CreateAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

ValueTask<T>

CreateAsync<TResult>(CancellationToken)

Builds the input and provisions a different application result type.

public ValueTask<TResult> CreateAsync<TResult>(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

ValueTask<TResult>

Type Parameters

TResult

CreateManyAsync(int, Action<ProtoDataObjectBuilder<T>, int>?, CancellationToken)

Builds and provisions multiple instances when input and result types are equal.

public ValueTask<IReadOnlyList<T>> CreateManyAsync(int count, Action<ProtoDataObjectBuilder<T>, int>? configure = null, CancellationToken cancellationToken = default)

Parameters

count int
configure Action<ProtoDataObjectBuilder<T>, int>
cancellationToken CancellationToken

Returns

ValueTask<IReadOnlyList<T>>

CreateManyAsync<TResult>(int, Action<ProtoDataObjectBuilder<T>, int>?, CancellationToken)

Builds and provisions multiple independently resolved instances.

public ValueTask<IReadOnlyList<TResult>> CreateManyAsync<TResult>(int count, Action<ProtoDataObjectBuilder<T>, int>? configure = null, CancellationToken cancellationToken = default)

Parameters

count int
configure Action<ProtoDataObjectBuilder<T>, int>
cancellationToken CancellationToken

Returns

ValueTask<IReadOnlyList<TResult>>

Type Parameters

TResult

Explain()

Resolves and describes all values without constructing the object. For types registered with a factory, only the explicit With(...) values and the construction source are described.

public ProtoDataExplanation Explain()

Returns

ProtoDataExplanation

With<TMember>(Expression<Func<T, TMember>>, TMember)

Sets a scenario-relevant property explicitly.

public ProtoDataObjectBuilder<T> With<TMember>(Expression<Func<T, TMember>> member, TMember value)

Parameters

member Expression<Func<T, TMember>>
value TMember

Returns

ProtoDataObjectBuilder<T>

Type Parameters

TMember