Skip to content

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

Overloads ​

NameDescription
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.

c#
public AssertionsChain<TSelf, TEnumerable> Contain(T? expected);

View source

Parameters ​

NameTypeDescription
expectedTThe item that should be present in the enumerable.

Returns ​

AssertionsChain<TSelf, TEnumerable>

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

Contain(T, IEqualityComparer<T>) ​

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

c#
public AssertionsChain<TSelf, TEnumerable> Contain(T? expected, IEqualityComparer<T> comparer);

View source

Parameters ​

NameTypeDescription
expectedTThe item that should be present in the enumerable.
comparerIEqualityComparer<T>The equality comparer to use for element comparison.

Returns ​

AssertionsChain<TSelf, TEnumerable>

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

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

c#
public AssertionsChain<TSelf, TEnumerable> Contain(T? expected, Func<T, T, bool> predicate);

View source

Parameters ​

NameTypeDescription
expectedT
predicateFunc<T, T, Boolean>

Returns ​

AssertionsChain<TSelf, TEnumerable>