Assert.Contains Method

Definition

Overloads

Contains(String, String, StringComparison, String)

Tests whether the specified string contains the specified substring and throws an exception if the substring does not occur within the test string.

Contains(Object, IEnumerable, IEqualityComparer, String, String, String)

Tests whether the specified collection contains the given element.

Contains(String, String, StringComparison, String, Object[])

Tests whether the specified string contains the specified substring and throws an exception if the substring does not occur within the test string.

Contains(String, String, String, String, String)

Tests whether the specified string contains the specified substring and throws an exception if the substring does not occur within the test string.

Contains(Object, IEnumerable, String, String, String)

Tests whether the specified collection contains the given element.

Contains(Func<Object,Boolean>, IEnumerable, String, String, String)

Tests whether the specified collection contains the given element.

Contains(String, String, StringComparison, String, String, String)

Tests whether the specified string contains the specified substring and throws an exception if the substring does not occur within the test string.

Contains(String, String, String, Object[])

Tests whether the specified string contains the specified substring and throws an exception if the substring does not occur within the test string.

Contains(Object, IEnumerable, String)

Tests whether the specified collection contains the given element.

Contains(String, String, StringComparison)

Tests whether the specified string contains the specified substring and throws an exception if the substring does not occur within the test string.

Contains(Func<Object,Boolean>, IEnumerable)

Tests whether the specified collection contains the given element.

Contains(Object, IEnumerable)

Tests whether the specified non-generic collection contains the given element.

Contains(String, String)

Tests whether the specified string contains the specified substring and throws an exception if the substring does not occur within the test string.

Contains(Object, IEnumerable, IEqualityComparer, String)

Tests whether the specified collection contains the given element.

Contains(Object, IEnumerable, IEqualityComparer)

Tests whether the specified collection contains the given element.

Contains(String, String, String)

Tests whether the specified string contains the specified substring and throws an exception if the substring does not occur within the test string.

Contains(Func<Object,Boolean>, IEnumerable, String)

Tests whether the specified collection contains the given element.

Contains<T>(T, IEnumerable<T>, IEqualityComparer<T>, String, String, String)

Tests whether the specified collection contains the given element.

Contains<T>(T, IEnumerable<T>, String, String, String)

Tests whether the specified collection contains the given element.

Contains<T>(T, IEnumerable<T>, IEqualityComparer<T>, String, Object[])

Tests whether the specified collection contains the given element.

Contains<T>(Func<T,Boolean>, IEnumerable<T>, String, String, String)

Tests whether the specified collection contains the given element.

Contains<T>(T, IEnumerable<T>, String, Object[])

Tests whether the specified collection contains the given element.

Contains<T>(T, IEnumerable<T>, IEqualityComparer<T>, String)

Tests whether the specified collection contains the given element.

Contains<T>(Func<T,Boolean>, IEnumerable<T>, String, Object[])

Tests whether the specified collection contains the given element.

Contains<T>(T, IEnumerable<T>, IEqualityComparer<T>)

Tests whether the specified collection contains the given element.

Contains<T>(IEnumerable<T>, Func<T,Boolean>, String)

Tests whether the specified collection contains the given element.

Contains<T>(T, IEnumerable<T>)

Tests whether the specified collection contains the given element.

Contains<T>(Func<T,Boolean>, IEnumerable<T>)

Tests whether the specified collection contains the given element.

Contains<T>(T, IEnumerable<T>, String)

Tests whether the specified collection contains the given element.

Contains<T>(Func<T,Boolean>, IEnumerable<T>, String)

Tests whether the specified collection contains the given element.

Contains(String, String, StringComparison, String)

Source:
Assert.Contains.cs
Source:
Assert.Contains.cs
Source:
Assert.Contains.cs
Source:
Assert.Contains.cs

Tests whether the specified string contains the specified substring and throws an exception if the substring does not occur within the test string.

public static void Contains(string substring, string value, StringComparison comparisonType, string? message);
static member Contains : string * string * StringComparison * string -> unit
Public Shared Sub Contains (substring As String, value As String, comparisonType As StringComparison, message As String)

Parameters

substring
String

The string expected to occur within value.

value
String

The string that is expected to contain substring.

comparisonType
StringComparison

The comparison method to compare strings comparisonType.

message
String

The message to include in the exception when substring is not in value. The message is shown in test results.

Exceptions

value is null, or substring is null, or value does not contain substring.

Applies to

Contains(Object, IEnumerable, IEqualityComparer, String, String, String)

Source:
Assert.Contains.cs

Tests whether the specified collection contains the given element.

public static void Contains(object? expected, System.Collections.IEnumerable collection, System.Collections.IEqualityComparer comparer, string? message = "", string expectedExpression = "", string collectionExpression = "");
static member Contains : obj * System.Collections.IEnumerable * System.Collections.IEqualityComparer * string * string * string -> unit
Public Shared Sub Contains (expected As Object, collection As IEnumerable, comparer As IEqualityComparer, Optional message As String = "", Optional expectedExpression As String = "", Optional collectionExpression As String = "")

Parameters

expected
Object

The expected item.

collection
IEnumerable

The collection.

comparer
IEqualityComparer

An equality comparer to compare values.

message
String

The message to display when the assertion fails.

expectedExpression
String

The syntactic expression of expected as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.

collectionExpression
String

The syntactic expression of collection as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.

Applies to

Contains(String, String, StringComparison, String, Object[])

Source:
Assert.Contains.cs
Source:
Assert.Contains.cs
Source:
Assert.Contains.cs
Source:
Assert.Contains.cs

Tests whether the specified string contains the specified substring and throws an exception if the substring does not occur within the test string.

public static void Contains(string substring, string value, StringComparison comparisonType, string? message, params object?[]? parameters);
static member Contains : string * string * StringComparison * string * obj[] -> unit
Public Shared Sub Contains (substring As String, value As String, comparisonType As StringComparison, message As String, ParamArray parameters As Object())

Parameters

substring
String

The string expected to occur within value.

value
String

The string that is expected to contain substring.

comparisonType
StringComparison

The comparison method to compare strings comparisonType.

message
String

The message to include in the exception when substring is not in value. The message is shown in test results.

parameters
Object[]

An array of parameters to use when formatting message.

Exceptions

value is null, or substring is null, or value does not contain substring.

Applies to

Contains(String, String, String, String, String)

Source:
Assert.Contains.cs

Tests whether the specified string contains the specified substring and throws an exception if the substring does not occur within the test string.

public static void Contains(string substring, string value, string? message = "", string substringExpression = "", string valueExpression = "");
static member Contains : string * string * string * string * string -> unit
Public Shared Sub Contains (substring As String, value As String, Optional message As String = "", Optional substringExpression As String = "", Optional valueExpression As String = "")

Parameters

substring
String

The string expected to occur within value.

value
String

The string that is expected to contain substring.

message
String

The message to include in the exception when substring is not in value. The message is shown in test results.

substringExpression
String

The syntactic expression of substring as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.

valueExpression
String

The syntactic expression of value as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.

Exceptions

value is null, or substring is null, or value does not contain substring.

Applies to

Contains(Object, IEnumerable, String, String, String)

Source:
Assert.Contains.cs

Tests whether the specified collection contains the given element.

public static void Contains(object? expected, System.Collections.IEnumerable collection, string? message = "", string expectedExpression = "", string collectionExpression = "");
static member Contains : obj * System.Collections.IEnumerable * string * string * string -> unit
Public Shared Sub Contains (expected As Object, collection As IEnumerable, Optional message As String = "", Optional expectedExpression As String = "", Optional collectionExpression As String = "")

Parameters

expected
Object

The expected item.

collection
IEnumerable

The collection.

message
String

The message to display when the assertion fails.

expectedExpression
String

The syntactic expression of expected as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.

collectionExpression
String

The syntactic expression of collection as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.

Applies to

Contains(Func<Object,Boolean>, IEnumerable, String, String, String)

Source:
Assert.Contains.cs

Tests whether the specified collection contains the given element.

public static void Contains(Func<object?,bool> predicate, System.Collections.IEnumerable collection, string? message = "", string predicateExpression = "", string collectionExpression = "");
static member Contains : Func<obj, bool> * System.Collections.IEnumerable * string * string * string -> unit
Public Shared Sub Contains (predicate As Func(Of Object, Boolean), collection As IEnumerable, Optional message As String = "", Optional predicateExpression As String = "", Optional collectionExpression As String = "")

Parameters

predicate
Func<Object,Boolean>

A function to test each element for a condition.

collection
IEnumerable

The collection.

message
String

The message to display when the assertion fails.

predicateExpression
String

The syntactic expression of predicate as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.

collectionExpression
String

The syntactic expression of collection as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.

Applies to

Contains(String, String, StringComparison, String, String, String)

Source:
Assert.Contains.cs

Tests whether the specified string contains the specified substring and throws an exception if the substring does not occur within the test string.

public static void Contains(string substring, string value, StringComparison comparisonType, string? message = "", string substringExpression = "", string valueExpression = "");
static member Contains : string * string * StringComparison * string * string * string -> unit
Public Shared Sub Contains (substring As String, value As String, comparisonType As StringComparison, Optional message As String = "", Optional substringExpression As String = "", Optional valueExpression As String = "")

Parameters

substring
String

The string expected to occur within value.

value
String

The string that is expected to contain substring.

comparisonType
StringComparison

The comparison method to compare strings comparisonType.

message
String

The message to include in the exception when substring is not in value. The message is shown in test results.

substringExpression
String

The syntactic expression of substring as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.

valueExpression
String

The syntactic expression of value as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.

Exceptions

value is null, or substring is null, or value does not contain substring.

Applies to

Contains(String, String, String, Object[])

Source:
Assert.Contains.cs
Source:
Assert.Contains.cs
Source:
Assert.Contains.cs
Source:
Assert.Contains.cs

Tests whether the specified string contains the specified substring and throws an exception if the substring does not occur within the test string.

public static void Contains(string substring, string value, string? message, params object?[]? parameters);
static member Contains : string * string * string * obj[] -> unit
Public Shared Sub Contains (substring As String, value As String, message As String, ParamArray parameters As Object())

Parameters

substring
String

The string expected to occur within value.

value
String

The string that is expected to contain substring.

message
String

The message to include in the exception when substring is not in value. The message is shown in test results.

parameters
Object[]

An array of parameters to use when formatting message.

Exceptions

value is null, or substring is null, or value does not contain substring.

Applies to

Contains(Object, IEnumerable, String)

Source:
Assert.Contains.cs

Tests whether the specified collection contains the given element.

public static void Contains(object? expected, System.Collections.IEnumerable collection, string? message);
static member Contains : obj * System.Collections.IEnumerable * string -> unit
Public Shared Sub Contains (expected As Object, collection As IEnumerable, message As String)

Parameters

expected
Object

The expected item.

collection
IEnumerable

The collection.

message
String

The message format to display when the assertion fails.

Applies to

Contains(String, String, StringComparison)

Source:
Assert.Contains.cs
Source:
Assert.Contains.cs
Source:
Assert.Contains.cs
Source:
Assert.Contains.cs

Tests whether the specified string contains the specified substring and throws an exception if the substring does not occur within the test string.

public static void Contains(string substring, string value, StringComparison comparisonType);
static member Contains : string * string * StringComparison -> unit
Public Shared Sub Contains (substring As String, value As String, comparisonType As StringComparison)

Parameters

substring
String

The string expected to occur within value.

value
String

The string that is expected to contain substring.

comparisonType
StringComparison

The comparison method to compare strings comparisonType.

Exceptions

value is null, or substring is null, or value does not contain substring.

Applies to

Contains(Func<Object,Boolean>, IEnumerable)

Source:
Assert.Contains.cs

Tests whether the specified collection contains the given element.

public static void Contains(Func<object?,bool> predicate, System.Collections.IEnumerable collection);
static member Contains : Func<obj, bool> * System.Collections.IEnumerable -> unit
Public Shared Sub Contains (predicate As Func(Of Object, Boolean), collection As IEnumerable)

Parameters

predicate
Func<Object,Boolean>

A function to test each element for a condition.

collection
IEnumerable

The collection.

Applies to

Contains(Object, IEnumerable)

Source:
Assert.Contains.cs

Tests whether the specified non-generic collection contains the given element.

public static void Contains(object? expected, System.Collections.IEnumerable collection);
static member Contains : obj * System.Collections.IEnumerable -> unit
Public Shared Sub Contains (expected As Object, collection As IEnumerable)

Parameters

expected
Object

The expected item.

collection
IEnumerable

The non-generic collection (like ArrayList).

Applies to

Contains(String, String)

Source:
Assert.Contains.cs
Source:
Assert.Contains.cs
Source:
Assert.Contains.cs
Source:
Assert.Contains.cs

Tests whether the specified string contains the specified substring and throws an exception if the substring does not occur within the test string.

public static void Contains(string substring, string value);
static member Contains : string * string -> unit
Public Shared Sub Contains (substring As String, value As String)

Parameters

substring
String

The string expected to occur within value.

value
String

The string that is expected to contain substring.

Exceptions

value is null, or substring is null, or value does not contain substring.

Applies to

Contains(Object, IEnumerable, IEqualityComparer, String)

Source:
Assert.Contains.cs

Tests whether the specified collection contains the given element.

public static void Contains(object expected, System.Collections.IEnumerable collection, System.Collections.IEqualityComparer comparer, string? message);
static member Contains : obj * System.Collections.IEnumerable * System.Collections.IEqualityComparer * string -> unit
Public Shared Sub Contains (expected As Object, collection As IEnumerable, comparer As IEqualityComparer, message As String)

Parameters

expected
Object

The expected item.

collection
IEnumerable

The collection.

comparer
IEqualityComparer

An equality comparer to compare values.

message
String

The message to display when the assertion fails.

Applies to

Contains(Object, IEnumerable, IEqualityComparer)

Source:
Assert.Contains.cs

Tests whether the specified collection contains the given element.

public static void Contains(object expected, System.Collections.IEnumerable collection, System.Collections.IEqualityComparer comparer);
static member Contains : obj * System.Collections.IEnumerable * System.Collections.IEqualityComparer -> unit
Public Shared Sub Contains (expected As Object, collection As IEnumerable, comparer As IEqualityComparer)

Parameters

expected
Object

The expected item.

collection
IEnumerable

The collection.

comparer
IEqualityComparer

An equality comparer to compare values.

Applies to

Contains(String, String, String)

Source:
Assert.Contains.cs
Source:
Assert.Contains.cs
Source:
Assert.Contains.cs
Source:
Assert.Contains.cs

Tests whether the specified string contains the specified substring and throws an exception if the substring does not occur within the test string.

public static void Contains(string substring, string value, string? message);
static member Contains : string * string * string -> unit
Public Shared Sub Contains (substring As String, value As String, message As String)

Parameters

substring
String

The string expected to occur within value.

value
String

The string that is expected to contain substring.

message
String

The message to include in the exception when substring is not in value. The message is shown in test results.

Exceptions

value is null, or substring is null, or value does not contain substring.

Applies to

Contains(Func<Object,Boolean>, IEnumerable, String)

Source:
Assert.Contains.cs

Tests whether the specified collection contains the given element.

public static void Contains(Func<object?,bool> predicate, System.Collections.IEnumerable collection, string? message);
static member Contains : Func<obj, bool> * System.Collections.IEnumerable * string -> unit
Public Shared Sub Contains (predicate As Func(Of Object, Boolean), collection As IEnumerable, message As String)

Parameters

predicate
Func<Object,Boolean>

A function to test each element for a condition.

collection
IEnumerable

The collection.

message
String

The message format to display when the assertion fails.

Applies to

Contains<T>(T, IEnumerable<T>, IEqualityComparer<T>, String, String, String)

Source:
Assert.Contains.cs

Tests whether the specified collection contains the given element.

public static void Contains<T>(T expected, System.Collections.Generic.IEnumerable<T> collection, System.Collections.Generic.IEqualityComparer<T> comparer, string? message = "", string expectedExpression = "", string collectionExpression = "");
static member Contains : 'T * seq<'T> * System.Collections.Generic.IEqualityComparer<'T> * string * string * string -> unit
Public Shared Sub Contains(Of T) (expected As T, collection As IEnumerable(Of T), comparer As IEqualityComparer(Of T), Optional message As String = "", Optional expectedExpression As String = "", Optional collectionExpression As String = "")

Type Parameters

T

The type of the collection items.

Parameters

expected
T

The expected item.

collection
IEnumerable<T>

The collection.

comparer
IEqualityComparer<T>

An equality comparer to compare values.

message
String

The message to display when the assertion fails.

expectedExpression
String

The syntactic expression of expected as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.

collectionExpression
String

The syntactic expression of collection as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.

Applies to

Contains<T>(T, IEnumerable<T>, String, String, String)

Source:
Assert.Contains.cs

Tests whether the specified collection contains the given element.

public static void Contains<T>(T expected, System.Collections.Generic.IEnumerable<T> collection, string? message = "", string expectedExpression = "", string collectionExpression = "");
static member Contains : 'T * seq<'T> * string * string * string -> unit
Public Shared Sub Contains(Of T) (expected As T, collection As IEnumerable(Of T), Optional message As String = "", Optional expectedExpression As String = "", Optional collectionExpression As String = "")

Type Parameters

T

The type of the collection items.

Parameters

expected
T

The expected item.

collection
IEnumerable<T>

The collection.

message
String

The message to display when the assertion fails.

expectedExpression
String

The syntactic expression of expected as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.

collectionExpression
String

The syntactic expression of collection as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.

Applies to

Contains<T>(T, IEnumerable<T>, IEqualityComparer<T>, String, Object[])

Source:
Assert.Contains.cs
Source:
Assert.Contains.cs
Source:
Assert.Contains.cs
Source:
Assert.Contains.cs

Tests whether the specified collection contains the given element.

public static void Contains<T>(T expected, System.Collections.Generic.IEnumerable<T> collection, System.Collections.Generic.IEqualityComparer<T> comparer, string? message, params object?[]? parameters);
static member Contains : 'T * seq<'T> * System.Collections.Generic.IEqualityComparer<'T> * string * obj[] -> unit
Public Shared Sub Contains(Of T) (expected As T, collection As IEnumerable(Of T), comparer As IEqualityComparer(Of T), message As String, ParamArray parameters As Object())

Type Parameters

T

The type of the collection items.

Parameters

expected
T

The expected item.

collection
IEnumerable<T>

The collection.

comparer
IEqualityComparer<T>

An equality comparer to compare values.

message
String

The message to display when the assertion fails.

parameters
Object[]

The parameters to format the message.

Applies to

Contains<T>(Func<T,Boolean>, IEnumerable<T>, String, String, String)

Source:
Assert.Contains.cs

Tests whether the specified collection contains the given element.

public static void Contains<T>(Func<T,bool> predicate, System.Collections.Generic.IEnumerable<T> collection, string? message = "", string predicateExpression = "", string collectionExpression = "");
static member Contains : Func<'T, bool> * seq<'T> * string * string * string -> unit
Public Shared Sub Contains(Of T) (predicate As Func(Of T, Boolean), collection As IEnumerable(Of T), Optional message As String = "", Optional predicateExpression As String = "", Optional collectionExpression As String = "")

Type Parameters

T

The type of the collection items.

Parameters

predicate
Func<T,Boolean>

A function to test each element for a condition.

collection
IEnumerable<T>

The collection.

message
String

The message to display when the assertion fails.

predicateExpression
String

The syntactic expression of predicate as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.

collectionExpression
String

The syntactic expression of collection as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.

Applies to

Contains<T>(T, IEnumerable<T>, String, Object[])

Source:
Assert.Contains.cs
Source:
Assert.Contains.cs
Source:
Assert.Contains.cs
Source:
Assert.Contains.cs

Tests whether the specified collection contains the given element.

public static void Contains<T>(T expected, System.Collections.Generic.IEnumerable<T> collection, string? message, params object?[]? parameters);
static member Contains : 'T * seq<'T> * string * obj[] -> unit
Public Shared Sub Contains(Of T) (expected As T, collection As IEnumerable(Of T), message As String, ParamArray parameters As Object())

Type Parameters

T

The type of the collection items.

Parameters

expected
T

The expected item.

collection
IEnumerable<T>

The collection.

message
String

The message format to display when the assertion fails.

parameters
Object[]

The parameters to format the message.

Applies to

Contains<T>(T, IEnumerable<T>, IEqualityComparer<T>, String)

Source:
Assert.Contains.cs
Source:
Assert.Contains.cs
Source:
Assert.Contains.cs
Source:
Assert.Contains.cs

Tests whether the specified collection contains the given element.

public static void Contains<T>(T expected, System.Collections.Generic.IEnumerable<T> collection, System.Collections.Generic.IEqualityComparer<T> comparer, string? message);
static member Contains : 'T * seq<'T> * System.Collections.Generic.IEqualityComparer<'T> * string -> unit
Public Shared Sub Contains(Of T) (expected As T, collection As IEnumerable(Of T), comparer As IEqualityComparer(Of T), message As String)

Type Parameters

T

The type of the collection items.

Parameters

expected
T

The expected item.

collection
IEnumerable<T>

The collection.

comparer
IEqualityComparer<T>

An equality comparer to compare values.

message
String

The message to display when the assertion fails.

Applies to

Contains<T>(Func<T,Boolean>, IEnumerable<T>, String, Object[])

Source:
Assert.Contains.cs
Source:
Assert.Contains.cs
Source:
Assert.Contains.cs
Source:
Assert.Contains.cs

Tests whether the specified collection contains the given element.

public static void Contains<T>(Func<T,bool> predicate, System.Collections.Generic.IEnumerable<T> collection, string? message, params object?[]? parameters);
static member Contains : Func<'T, bool> * seq<'T> * string * obj[] -> unit
Public Shared Sub Contains(Of T) (predicate As Func(Of T, Boolean), collection As IEnumerable(Of T), message As String, ParamArray parameters As Object())

Type Parameters

T

The type of the collection items.

Parameters

predicate
Func<T,Boolean>

A function to test each element for a condition.

collection
IEnumerable<T>

The collection.

message
String

The message format to display when the assertion fails.

parameters
Object[]

The parameters to format the message.

Applies to

Contains<T>(T, IEnumerable<T>, IEqualityComparer<T>)

Source:
Assert.Contains.cs
Source:
Assert.Contains.cs
Source:
Assert.Contains.cs
Source:
Assert.Contains.cs

Tests whether the specified collection contains the given element.

public static void Contains<T>(T expected, System.Collections.Generic.IEnumerable<T> collection, System.Collections.Generic.IEqualityComparer<T> comparer);
static member Contains : 'T * seq<'T> * System.Collections.Generic.IEqualityComparer<'T> -> unit
Public Shared Sub Contains(Of T) (expected As T, collection As IEnumerable(Of T), comparer As IEqualityComparer(Of T))

Type Parameters

T

The type of the collection items.

Parameters

expected
T

The expected item.

collection
IEnumerable<T>

The collection.

comparer
IEqualityComparer<T>

An equality comparer to compare values.

Applies to

Contains<T>(IEnumerable<T>, Func<T,Boolean>, String)

Source:
Assert.Contains.cs
Source:
Assert.Contains.cs

Tests whether the specified collection contains the given element.

public static void Contains<T>(System.Collections.Generic.IEnumerable<T> collection, Func<T,bool> predicate, string? message);
static member Contains : seq<'T> * Func<'T, bool> * string -> unit
Public Shared Sub Contains(Of T) (collection As IEnumerable(Of T), predicate As Func(Of T, Boolean), message As String)

Type Parameters

T

The type of the collection items.

Parameters

collection
IEnumerable<T>

The collection.

predicate
Func<T,Boolean>

A function to test each element for a condition.

message
String

The message to display when the assertion fails.

Applies to

Contains<T>(T, IEnumerable<T>)

Source:
Assert.Contains.cs
Source:
Assert.Contains.cs
Source:
Assert.Contains.cs
Source:
Assert.Contains.cs

Tests whether the specified collection contains the given element.

public static void Contains<T>(T expected, System.Collections.Generic.IEnumerable<T> collection);
static member Contains : 'T * seq<'T> -> unit
Public Shared Sub Contains(Of T) (expected As T, collection As IEnumerable(Of T))

Type Parameters

T

The type of the collection items.

Parameters

expected
T

The expected item.

collection
IEnumerable<T>

The collection.

Applies to

Contains<T>(Func<T,Boolean>, IEnumerable<T>)

Source:
Assert.Contains.cs
Source:
Assert.Contains.cs
Source:
Assert.Contains.cs
Source:
Assert.Contains.cs

Tests whether the specified collection contains the given element.

public static void Contains<T>(Func<T,bool> predicate, System.Collections.Generic.IEnumerable<T> collection);
static member Contains : Func<'T, bool> * seq<'T> -> unit
Public Shared Sub Contains(Of T) (predicate As Func(Of T, Boolean), collection As IEnumerable(Of T))

Type Parameters

T

The type of the collection items.

Parameters

predicate
Func<T,Boolean>

A function to test each element for a condition.

collection
IEnumerable<T>

The collection.

Applies to

Contains<T>(T, IEnumerable<T>, String)

Source:
Assert.Contains.cs
Source:
Assert.Contains.cs
Source:
Assert.Contains.cs
Source:
Assert.Contains.cs

Tests whether the specified collection contains the given element.

public static void Contains<T>(T expected, System.Collections.Generic.IEnumerable<T> collection, string? message);
static member Contains : 'T * seq<'T> * string -> unit
Public Shared Sub Contains(Of T) (expected As T, collection As IEnumerable(Of T), message As String)

Type Parameters

T

The type of the collection items.

Parameters

expected
T

The expected item.

collection
IEnumerable<T>

The collection.

message
String

The message to display when the assertion fails.

Applies to

Contains<T>(Func<T,Boolean>, IEnumerable<T>, String)

Source:
Assert.Contains.cs
Source:
Assert.Contains.cs

Tests whether the specified collection contains the given element.

public static void Contains<T>(Func<T,bool> predicate, System.Collections.Generic.IEnumerable<T> collection, string? message);
static member Contains : Func<'T, bool> * seq<'T> * string -> unit
Public Shared Sub Contains(Of T) (predicate As Func(Of T, Boolean), collection As IEnumerable(Of T), message As String)

Type Parameters

T

The type of the collection items.

Parameters

predicate
Func<T,Boolean>

A function to test each element for a condition.

collection
IEnumerable<T>

The collection.

message
String

The message to display when the assertion fails.

Applies to