MSDN Library
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

CollectionAssert.AllItemsAreInstancesOfType Method (ICollection, Type, String)

 

Verifies that all elements in the specified collection are instances of the specified type. The assertion fails if there exists one element in the collection for which the specified type is not found in its inheritance hierarchy. Displays a message if the assertion fails.

Namespace:   Microsoft.VisualStudio.TestTools.UnitTesting
Assembly:  Microsoft.VisualStudio.QualityTools.UnitTestFramework (in Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll)

public static void AllItemsAreInstancesOfType(
	ICollection collection,
	Type expectedType,
	string message
)

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.

message
Type: System.String

A message to display if the assertion fails. This message can be seen in the unit test results.

Exception Condition
AssertFailedException

An element in collection is null or expectedType is not found in the inheritance hierarchy of all elements in collection.

Return to top
Show:
© 2016 Microsoft