Skip to content

EnumerableAssertions<TSelf, TEnumerable, T> Class ​

Definition ​

Base class for assertions on enumerable values.

c#
public abstract class EnumerableAssertions<TSelf, TEnumerable, T> : ObjectAssertions<TSelf, TEnumerable>
   where TSelf : EnumerableAssertions<TSelf, TEnumerable, T>
   where TEnumerable : IEnumerable<T>

View source

Type Parameters ​

NameDescription
TSelfThe type of the derived assertions class, returned from And to allow chaining.
TEnumerableThe type of the enumerable being asserted on.
TThe type of elements in the enumerable.

Constructors ​

NameDescription
EnumerableAssertions(TEnumerable)Base class for assertions on enumerable values.

Methods ​

NameDescription
AllBeOfType<TOther>()Asserts that all items in the enumerable are of the specified type.
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>)
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.
NotContain(T)Asserts that the enumerable does not contain the specified item.
NotContain(T, IEqualityComparer<T>)Asserts that the enumerable does not contain the specified item using the specified equality comparer.
NotContain(T, Func<T, T, Boolean>)
NotSequenceEqual(IEnumerable<T>)Asserts that the enumerable is not sequence equal to the expected elements.
NotSequenceEqual(IEnumerable<T>, IEqualityComparer<T>)Asserts that the enumerable is not sequence equal to the expected elements using the specified equality comparer.
NotSequenceEqual(IEnumerable<T>, Func<T, T, Boolean>)
OnlyContain(Func<T, Boolean>, String)Asserts that all items in the enumerable satisfy the specified predicate.
SequenceEqual(IEnumerable<T>)Asserts that the enumerable is sequence equal to the expected elements.
SequenceEqual(IEnumerable<T>, IEqualityComparer<T>)Asserts that the enumerable is sequence equal to the expected elements using the specified equality comparer.
SequenceEqual(IEnumerable<T>, Func<T, T, Boolean>)