EnumerableAssertions<TEnumerable, T>.ContainSingle Method
Overloads
| Name | Description |
|---|---|
| ContainSingle() | Asserts that the enumerable contains exactly one item. |
| ContainSingle(Func<T, Boolean>, String) | Asserts that the enumerable contains exactly one item that satisfies the specified predicate. |
ContainSingle()
Asserts that the enumerable contains exactly one item.
public ObjectAssertionsChain<T> ContainSingle();
Returns
An ObjectAssertionsChain<T> for the single item.
ContainSingle(Func<T, Boolean>, String)
Asserts that the enumerable contains exactly one item that satisfies the specified predicate.
public ObjectAssertionsChain<T> ContainSingle(Func<T, bool> predicate, string? predicateExpression = null);
Parameters
| Name | Type | Description |
|---|---|---|
| predicate | Func<T, Boolean> | The predicate to match. |
| predicateExpression | String | The expression text of the predicate, captured automatically. |
Returns
An ObjectAssertionsChain<T> for the single matching item.