Class ProtoSheetModel<TRow>
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
Should
The assertions of this model, for example Should.MatchModel().
public ProtoSheetModelAssertions<TRow> Should { get; }
Property Value
ShouldNot
The negated assertions of this model, for example ShouldNot.MatchHeaders().
public ProtoSheetModelAssertions<TRow> ShouldNot { get; }
Property Value
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
propertyExpression<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
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().