Fluent Assertions Documentation
FluentAssertions.Collections Namespace / GenericCollectionAssertions<TCollection,T> Class
Members
In This Topic
    GenericCollectionAssertions<TCollection,T> Class
    In This Topic
    Object Model
    GenericCollectionAssertions<TCollection,T> ClassAssertionChain Class
    Syntax
    Type Parameters
    TCollection
    T
    Inheritance Hierarchy
    Public Constructors
    Public Properties
     NameDescription
    Public PropertyProvides access to the FluentAssertions.Execution.AssertionChain that this assertion class was initialized with. (Inherited from FluentAssertions.Primitives.ReferenceTypeAssertions<TCollection,TAssertions>)
    Public Property Gets the object whose value is being asserted. (Inherited from FluentAssertions.Primitives.ReferenceTypeAssertions<TCollection,TAssertions>)
    Top
    Protected Properties
     NameDescription
    Protected Property Returns the type of the subject the assertion applies on. It should be a user-friendly name as it is included in the failure message. Returns the type of the subject the assertion applies on. (Inherited from FluentAssertions.Collections.GenericCollectionAssertions<TCollection,T,GenericCollectionAssertions<TCollection,T>>)
    Top
    Public Methods
     NameDescription
    Public MethodOverloaded. Asserts that all items in the collection are of the specified type TExpectation (Inherited from FluentAssertions.Collections.GenericCollectionAssertions<TCollection,T,GenericCollectionAssertions<TCollection,T>>)
    Public MethodOverloaded.  Asserts that all elements in a collection of objects are equivalent to a given object. (Inherited from FluentAssertions.Collections.GenericCollectionAssertions<TCollection,T,GenericCollectionAssertions<TCollection,T>>)
    Public MethodOverloaded. Asserts that all items in the collection are of the exact specified type TExpectation (Inherited from FluentAssertions.Collections.GenericCollectionAssertions<TCollection,T,GenericCollectionAssertions<TCollection,T>>)
    Public Method Asserts that a collection contains only items which meet the criteria provided by the inspector. (Inherited from FluentAssertions.Collections.GenericCollectionAssertions<TCollection,T,GenericCollectionAssertions<TCollection,T>>)
    Public MethodOverloaded. Asserts that the object is assignable to a variable of type T. (Inherited from FluentAssertions.Primitives.ReferenceTypeAssertions<TCollection,TAssertions>)
    Public Method Asserts that the collection does not contain any items. (Inherited from FluentAssertions.Collections.GenericCollectionAssertions<TCollection,T,GenericCollectionAssertions<TCollection,T>>)
    Public MethodOverloaded.  Asserts that a collection of objects is equivalent to another collection of objects. (Inherited from FluentAssertions.Collections.GenericCollectionAssertions<TCollection,T,GenericCollectionAssertions<TCollection,T>>)
    Public MethodOverloaded. Asserts that a collection is ordered in ascending order according to the value of the specified propertyExpression. (Inherited from FluentAssertions.Collections.GenericCollectionAssertions<TCollection,T,GenericCollectionAssertions<TCollection,T>>)
    Public MethodOverloaded. Asserts that a collection is ordered in descending order according to the value of the specified propertyExpression. (Inherited from FluentAssertions.Collections.GenericCollectionAssertions<TCollection,T,GenericCollectionAssertions<TCollection,T>>)
    Public Method Asserts that the current object has not been initialized yet. (Inherited from FluentAssertions.Primitives.ReferenceTypeAssertions<TCollection,TAssertions>)
    Public Method Asserts that the collection is null or does not contain any items. (Inherited from FluentAssertions.Collections.GenericCollectionAssertions<TCollection,T,GenericCollectionAssertions<TCollection,T>>)
    Public MethodOverloaded. Asserts that the object is of the specified type T. (Inherited from FluentAssertions.Primitives.ReferenceTypeAssertions<TCollection,TAssertions>)
    Public Method Asserts that an object reference refers to the exact same object as another object reference. (Inherited from FluentAssertions.Primitives.ReferenceTypeAssertions<TCollection,TAssertions>)
    Public MethodAsserts that the collection is a subset of the expectedSuperset. (Inherited from FluentAssertions.Collections.GenericCollectionAssertions<TCollection,T,GenericCollectionAssertions<TCollection,T>>)
    Public MethodOverloaded.  Asserts that the collection contains the specified item. (Inherited from FluentAssertions.Collections.GenericCollectionAssertions<TCollection,T,GenericCollectionAssertions<TCollection,T>>)
    Public MethodOverloaded. Asserts that at least one element in the collection is equivalent to expectation. (Inherited from FluentAssertions.Collections.GenericCollectionAssertions<TCollection,T,GenericCollectionAssertions<TCollection,T>>)
    Public MethodOverloaded. Expects the current collection to contain the specified elements in the exact same order, and to be consecutive. using their System.Object.Equals(System.Object) implementation. (Inherited from FluentAssertions.Collections.GenericCollectionAssertions<TCollection,T,GenericCollectionAssertions<TCollection,T>>)
    Public MethodOverloaded. Expects the current collection to contain the specified elements in the exact same order, not necessarily consecutive. using their System.Object.Equals(System.Object) implementation. (Inherited from FluentAssertions.Collections.GenericCollectionAssertions<TCollection,T,GenericCollectionAssertions<TCollection,T>>)
    Public MethodAsserts that the current collection contains at least one element that is assignable to the type TExpectation. (Inherited from FluentAssertions.Collections.GenericCollectionAssertions<TCollection,T,GenericCollectionAssertions<TCollection,T>>)
    Public MethodOverloaded.  Expects the current collection to contain only a single item. (Inherited from FluentAssertions.Collections.GenericCollectionAssertions<TCollection,T,GenericCollectionAssertions<TCollection,T>>)
    Public MethodOverloaded. Asserts that the current collection ends with same elements in the same order as the collection identified by expectation. Elements are compared using their System.Object.Equals(System.Object). (Inherited from FluentAssertions.Collections.GenericCollectionAssertions<TCollection,T,GenericCollectionAssertions<TCollection,T>>)
    Public MethodOverloaded. Expects the current collection to contain all the same elements in the same order as the collection identified by elements. Elements are compared using their System.Object.Equals(System.Object) method. (Inherited from FluentAssertions.Collections.GenericCollectionAssertions<TCollection,T,GenericCollectionAssertions<TCollection,T>>)
    Public Method (Inherited from FluentAssertions.Collections.GenericCollectionAssertions<TCollection,T,GenericCollectionAssertions<TCollection,T>>)
    Public MethodOverloaded. Asserts that the number of items in the collection matches the supplied expected amount. (Inherited from FluentAssertions.Collections.GenericCollectionAssertions<TCollection,T,GenericCollectionAssertions<TCollection,T>>)
    Public MethodAsserts that the number of items in the collection is greater than the supplied expected amount. (Inherited from FluentAssertions.Collections.GenericCollectionAssertions<TCollection,T,GenericCollectionAssertions<TCollection,T>>)
    Public MethodAsserts that the number of items in the collection is greater than or equal to the supplied expected amount. (Inherited from FluentAssertions.Collections.GenericCollectionAssertions<TCollection,T,GenericCollectionAssertions<TCollection,T>>)
    Public MethodAsserts that the number of items in the collection is less than the supplied expected amount. (Inherited from FluentAssertions.Collections.GenericCollectionAssertions<TCollection,T,GenericCollectionAssertions<TCollection,T>>)
    Public MethodAsserts that the number of items in the collection is less than or equal to the supplied expected amount. (Inherited from FluentAssertions.Collections.GenericCollectionAssertions<TCollection,T,GenericCollectionAssertions<TCollection,T>>)
    Public MethodAsserts that the current collection has the supplied element at the supplied index. (Inherited from FluentAssertions.Collections.GenericCollectionAssertions<TCollection,T,GenericCollectionAssertions<TCollection,T>>)
    Public MethodAsserts that the expectation element directly precedes the successor. (Inherited from FluentAssertions.Collections.GenericCollectionAssertions<TCollection,T,GenericCollectionAssertions<TCollection,T>>)
    Public MethodAsserts that the expectation element directly succeeds the predecessor. (Inherited from FluentAssertions.Collections.GenericCollectionAssertions<TCollection,T,GenericCollectionAssertions<TCollection,T>>)
    Public MethodAssert that the current collection has the same number of elements as otherCollection. (Inherited from FluentAssertions.Collections.GenericCollectionAssertions<TCollection,T,GenericCollectionAssertions<TCollection,T>>)
    Public MethodAsserts that the collection shares one or more items with the specified otherCollection. (Inherited from FluentAssertions.Collections.GenericCollectionAssertions<TCollection,T,GenericCollectionAssertions<TCollection,T>>)
    Public MethodOverloaded. Asserts that the predicate is satisfied. (Inherited from FluentAssertions.Primitives.ReferenceTypeAssertions<TCollection,TAssertions>)
    Public MethodOverloaded. Asserts that the object is not assignable to a variable of type T. (Inherited from FluentAssertions.Primitives.ReferenceTypeAssertions<TCollection,TAssertions>)
    Public Method Asserts that the collection contains at least 1 item. (Inherited from FluentAssertions.Collections.GenericCollectionAssertions<TCollection,T,GenericCollectionAssertions<TCollection,T>>)
    Public MethodOverloaded. Expects the current collection not to contain all elements of the collection identified by unexpected, regardless of the order. Elements are compared using their System.Object.Equals(System.Object). (Inherited from FluentAssertions.Collections.GenericCollectionAssertions<TCollection,T,GenericCollectionAssertions<TCollection,T>>)
    Public MethodOverloaded. Asserts that a collection is not ordered in ascending order according to the value of the specified propertyExpression. (Inherited from FluentAssertions.Collections.GenericCollectionAssertions<TCollection,T,GenericCollectionAssertions<TCollection,T>>)
    Public MethodOverloaded. Asserts that a collection is not ordered in descending order according to the value of the specified propertyExpression. (Inherited from FluentAssertions.Collections.GenericCollectionAssertions<TCollection,T,GenericCollectionAssertions<TCollection,T>>)
    Public Method Asserts that the current object has been initialized. (Inherited from FluentAssertions.Primitives.ReferenceTypeAssertions<TCollection,TAssertions>)
    Public Method Asserts that the collection is not null and contains at least 1 item. (Inherited from FluentAssertions.Collections.GenericCollectionAssertions<TCollection,T,GenericCollectionAssertions<TCollection,T>>)
    Public MethodOverloaded. Asserts that the object is not of the specified type T. (Inherited from FluentAssertions.Primitives.ReferenceTypeAssertions<TCollection,TAssertions>)
    Public Method Asserts that an object reference refers to a different object than another object reference refers to. (Inherited from FluentAssertions.Primitives.ReferenceTypeAssertions<TCollection,TAssertions>)
    Public MethodAsserts that the collection is not a subset of the unexpectedSuperset. (Inherited from FluentAssertions.Collections.GenericCollectionAssertions<TCollection,T,GenericCollectionAssertions<TCollection,T>>)
    Public MethodOverloaded. Asserts that the current collection does not contain the supplied unexpected item. (Inherited from FluentAssertions.Collections.GenericCollectionAssertions<TCollection,T,GenericCollectionAssertions<TCollection,T>>)
    Public MethodOverloaded. Asserts that no element in the collection is equivalent to unexpected. (Inherited from FluentAssertions.Collections.GenericCollectionAssertions<TCollection,T,GenericCollectionAssertions<TCollection,T>>)
    Public MethodOverloaded.  Asserts the current collection does not contain the specified elements in the exact same order and are consecutive. (Inherited from FluentAssertions.Collections.GenericCollectionAssertions<TCollection,T,GenericCollectionAssertions<TCollection,T>>)
    Public MethodOverloaded.  Asserts the current collection does not contain the specified elements in the exact same order, not necessarily consecutive. (Inherited from FluentAssertions.Collections.GenericCollectionAssertions<TCollection,T,GenericCollectionAssertions<TCollection,T>>)
    Public MethodOverloaded. Asserts that the current collection does not contain any elements that are assignable to the type TExpectation. (Inherited from FluentAssertions.Collections.GenericCollectionAssertions<TCollection,T,GenericCollectionAssertions<TCollection,T>>)
    Public MethodOverloaded. Asserts that the collection does not contain any a null reference (Nothing in Visual Basic) items. (Inherited from FluentAssertions.Collections.GenericCollectionAssertions<TCollection,T,GenericCollectionAssertions<TCollection,T>>)
    Public MethodExpects the current collection not to contain all the same elements in the same order as the collection identified by unexpected. Elements are compared using their System.Object.Equals(System.Object). (Inherited from FluentAssertions.Collections.GenericCollectionAssertions<TCollection,T,GenericCollectionAssertions<TCollection,T>>)
    Public MethodAsserts that the number of items in the collection does not match the supplied unexpected amount. (Inherited from FluentAssertions.Collections.GenericCollectionAssertions<TCollection,T,GenericCollectionAssertions<TCollection,T>>)
    Public MethodAssert that the current collection does not have the same number of elements as otherCollection. (Inherited from FluentAssertions.Collections.GenericCollectionAssertions<TCollection,T,GenericCollectionAssertions<TCollection,T>>)
    Public MethodAsserts that the collection does not share any items with the specified otherCollection. (Inherited from FluentAssertions.Collections.GenericCollectionAssertions<TCollection,T,GenericCollectionAssertions<TCollection,T>>)
    Public Method Asserts that the collection only contains items that match a predicate. (Inherited from FluentAssertions.Collections.GenericCollectionAssertions<TCollection,T,GenericCollectionAssertions<TCollection,T>>)
    Public MethodOverloaded.  Asserts that the collection does not contain any duplicate items. (Inherited from FluentAssertions.Collections.GenericCollectionAssertions<TCollection,T,GenericCollectionAssertions<TCollection,T>>)
    Public MethodOverloaded.  Asserts that a collection contains exactly a given number of elements which meet the criteria provided by the element predicates. Assertion fails if it is not possible to find a one-to-one mapping between the elements of the collection and the predicates. The order of the predicates does not need to match the order of the elements. (Inherited from FluentAssertions.Collections.GenericCollectionAssertions<TCollection,T,GenericCollectionAssertions<TCollection,T>>)
    Public MethodOverloaded.  Asserts that a collection contains exactly a given number of elements, which meet the criteria provided by the element inspectors. (Inherited from FluentAssertions.Collections.GenericCollectionAssertions<TCollection,T,GenericCollectionAssertions<TCollection,T>>)
    Public MethodOverloaded. Asserts that the current collection starts with same elements in the same order as the collection identified by expectation. Elements are compared using their System.Object.Equals(System.Object). (Inherited from FluentAssertions.Collections.GenericCollectionAssertions<TCollection,T,GenericCollectionAssertions<TCollection,T>>)
    Top
    Extension Methods
     NameDescription
    Public Extension MethodSafely casts the specified object to the type specified through TTo.
    Public Extension MethodOverloaded. Invokes the specified action on a subject so that you can chain it with any of the assertions from FluentAssertions.Specialized.NonGenericAsyncFunctionAssertions
    Public Extension MethodOverloaded. Forces enumerating a collection. Should be used to assert that a method that uses the yield keyword throws a particular exception.
    Public Extension Method Provides methods for asserting the execution time of a method or property.
    Public Extension MethodOverloaded. Invokes the specified action on a subject so that you can chain it with any of the assertions from FluentAssertions.Specialized.ActionAssertions
    Public Extension MethodOverloaded. Starts monitoring eventSource for its events.
    Public Extension MethodOverloaded. Returns an FluentAssertions.Specialized.ExecutionTimeAssertions object that can be used to assert the current FluentAssertions.Specialized.ExecutionTime.
    Public Extension MethodOverloaded. Returns an FluentAssertions.Primitives.EnumAssertions<TEnum,TAssertions> object that can be used to assert the current TEnum.
    Top
    Requirements

    Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

    See Also