EnumerableAssertions<TSelf, 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.
c#
public AssertionsChain<ObjectAssertions<T>, T> ContainSingle();Returns
AssertionsChain<ObjectAssertions<T>, T>
An AssertionsChain<TAssertions, T> for the single item.
ContainSingle(Func<T, Boolean>, String)
Asserts that the enumerable contains exactly one item that satisfies the specified predicate.
c#
public AssertionsChain<ObjectAssertions<T>, 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
AssertionsChain<ObjectAssertions<T>, T>
An AssertionsChain<TAssertions, T> for the single matching item.