Class ProtoSheetModel<TRow>

Namespace
ProtoTest.Sheets
Assembly
ProtoTest.Sheets.dll

A sheet modelled as a record: [Sheet] and [Column] declare the layout once, the model verifies it, and tests read typed rows and columns without repeating header paths. Rows are constructed through the record's primary constructor, so its guards run; ProtoSheetModel<TRow> remains the escape hatch for shapes a record cannot hold.

public sealed class ProtoSheetModel<TRow> where TRow : notnull

Type Parameters

TRow
Inheritance
ProtoSheetModel<TRow>
Inherited Members
Extension Methods

Properties

Rows

The data rows, projected onto the record.

public IReadOnlyList<TRow> Rows { get; }

Property Value

IReadOnlyList<TRow>

Sheet

public ProtoSheet Sheet { get; }

Property Value

ProtoSheet

Should

The assertions of this model, for example Should.MatchModel().

public ProtoSheetModelAssertions<TRow> Should { get; }

Property Value

ProtoSheetModelAssertions<TRow>

ShouldNot

The negated assertions of this model, for example ShouldNot.MatchHeaders().

public ProtoSheetModelAssertions<TRow> ShouldNot { get; }

Property Value

ProtoSheetModelAssertions<TRow>

Methods

Column<TValue>(Expression<Func<TRow, TValue>>)

Reads a whole column as typed values with property-style assertions.

public ProtoModelColumn<TValue> Column<TValue>(Expression<Func<TRow, TValue>> property)

Parameters

property Expression<Func<TRow, TValue>>

Returns

ProtoModelColumn<TValue>

Type Parameters

TValue

Row(Func<TRow, bool>)

Finds the first row matching the predicate; no match fails the test.

public TRow Row(Func<TRow, bool> predicate)

Parameters

predicate Func<TRow, bool>

Returns

TRow

Verify()

Checks every declared column against the record's shape; all violations are reported.

[Obsolete("Use Should.MatchModel() instead.")]
public void Verify()

Remarks

Obsolete: use Should.MatchModel().