Skip to content

EnumerableAssertions<TSelf, TEnumerable, T>.OnlyContain Method ​

Definition ​

Asserts that all items in the enumerable satisfy the specified predicate.

c#
public AssertionsChain<TSelf, TEnumerable> OnlyContain(Func<T, bool> predicate, string? predicateExpression = null);

View source

Parameters ​

NameTypeDescription
predicateFunc<T, Boolean>The predicate that all items must satisfy.
predicateExpressionStringThe expression text of the predicate, captured automatically.

Returns ​

AssertionsChain<TSelf, TEnumerable>

An AssertionsChain<TAssertions, T> for chaining further assertions.