共用方式為


CollectionAssert.DoesNotContain Method

Definition

Overloads

DoesNotContain(ICollection, Object)

Tests whether the specified collection does not contain the specified element and throws an exception if the element is in the collection.

DoesNotContain(ICollection, Object, String)

Tests whether the specified collection does not contain the specified element and throws an exception if the element is in the collection.

DoesNotContain(ICollection, Object, String, Object[])

Tests whether the specified collection does not contain the specified element and throws an exception if the element is in the collection.

DoesNotContain(ICollection, Object)

Tests whether the specified collection does not contain the specified element and throws an exception if the element is in the collection.

public:
 static void DoesNotContain(System::Collections::ICollection ^ collection, System::Object ^ element);
public static void DoesNotContain (System.Collections.ICollection collection, object element);
static member DoesNotContain : System.Collections.ICollection * obj -> unit
Public Shared Sub DoesNotContain (collection As ICollection, element As Object)

Parameters

collection
ICollection

The collection in which to search for the element.

element
Object

The element that is expected not to be in the collection.

Exceptions

Thrown if element is found in collection.

Applies to

DoesNotContain(ICollection, Object, String)

Tests whether the specified collection does not contain the specified element and throws an exception if the element is in the collection.

public:
 static void DoesNotContain(System::Collections::ICollection ^ collection, System::Object ^ element, System::String ^ message);
public static void DoesNotContain (System.Collections.ICollection collection, object element, string message);
static member DoesNotContain : System.Collections.ICollection * obj * string -> unit
Public Shared Sub DoesNotContain (collection As ICollection, element As Object, message As String)

Parameters

collection
ICollection

The collection in which to search for the element.

element
Object

The element that is expected not to be in the collection.

message
String

The message to include in the exception when element is in collection. The message is shown in test results.

Exceptions

Thrown if element is found in collection.

Applies to

DoesNotContain(ICollection, Object, String, Object[])

Tests whether the specified collection does not contain the specified element and throws an exception if the element is in the collection.

public:
 static void DoesNotContain(System::Collections::ICollection ^ collection, System::Object ^ element, System::String ^ message, ... cli::array <System::Object ^> ^ parameters);
public static void DoesNotContain (System.Collections.ICollection collection, object element, string message, params object[] parameters);
static member DoesNotContain : System.Collections.ICollection * obj * string * obj[] -> unit
Public Shared Sub DoesNotContain (collection As ICollection, element As Object, message As String, ParamArray parameters As Object())

Parameters

collection
ICollection

The collection in which to search for the element.

element
Object

The element that is expected not to be in the collection.

message
String

The message to include in the exception when element is in collection. The message is shown in test results.

parameters
Object[]

An array of parameters to use when formatting message.

Exceptions

Thrown if element is found in collection.

Applies to