CollectionAssert.AllItemsAreInstancesOfType Method (ICollection, Type)
Verifies that all elements in the specified collection are instances of the specified type. The assertion fails if for any element the type is not found in its inheritance hierarchy.
Namespace: Microsoft.VisualStudio.TestTools.UnitTesting
Assembly: Microsoft.VisualStudio.QualityTools.UnitTestFramework (in Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll)
Syntax
'Declaration
Public Shared Sub AllItemsAreInstancesOfType ( _
collection As ICollection, _
expectedType As Type _
)
public static void AllItemsAreInstancesOfType(
ICollection collection,
Type expectedType
)
public:
static void AllItemsAreInstancesOfType(
ICollection^ collection,
Type^ expectedType
)
static member AllItemsAreInstancesOfType :
collection:ICollection *
expectedType:Type -> unit
public static function AllItemsAreInstancesOfType(
collection : ICollection,
expectedType : Type
)
Parameters
- collection
Type: System.Collections.ICollection
The collection to verify.
- expectedType
Type: System.Type
The type expected to be found in the inheritance hierarchy of every element in collection.
Exceptions
Exception | Condition |
---|---|
AssertFailedException | An element in collection is nulla null reference (Nothing in Visual Basic) or expectedType is not found in the inheritance hierarchy of all elements in collection. |
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
See Also
Reference
AllItemsAreInstancesOfType Overload
Microsoft.VisualStudio.TestTools.UnitTesting Namespace