Skip to content

EnumerableAssertions<TEnumerable, T>.Contain Method

Overloads

Name Description
Contain(T) Asserts that the enumerable contains the specified item.
Contain(T, IEqualityComparer<T>) Asserts that the enumerable contains the specified item using the specified equality comparer.
Contain(T, Func<T, T, Boolean>)

Contain(T)

Asserts that the enumerable contains the specified item.

public EnumerableAssertionsChain<TEnumerable, T> Contain(T? expected);

Parameters

Name Type Description
expected T The item that should be present in the enumerable.

Returns

EnumerableAssertionsChain<TEnumerable, T>

An EnumerableAssertionsChain<TEnumerable, T> for chaining further assertions.

Contain(T, IEqualityComparer<T>)

Asserts that the enumerable contains the specified item using the specified equality comparer.

public EnumerableAssertionsChain<TEnumerable, T> Contain(T? expected, IEqualityComparer<T> comparer);

Parameters

Name Type Description
expected T The item that should be present in the enumerable.
comparer IEqualityComparer<T> The equality comparer to use for element comparison.

Returns

EnumerableAssertionsChain<TEnumerable, T>

An EnumerableAssertionsChain<TEnumerable, T> for chaining further assertions.

Contain(T, Func<T, T, Boolean>)

public EnumerableAssertionsChain<TEnumerable, T> Contain(T? expected, Func<T, T, bool> predicate);

Parameters

Name Type Description
expected T
predicate Func<T, T, Boolean>

Returns

EnumerableAssertionsChain<TEnumerable, T>