次の方法で共有


Assert.ContainsSingle Method

Definition

Overloads

ContainsSingle<T>(IEnumerable<T>)

Tests whether the specified collection contains exactly one element.

ContainsSingle<T>(IEnumerable<T>, Assert.AssertSingleInterpolatedStringHandler<T>)

Tests whether the specified collection contains exactly one element.

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

Tests whether the specified collection contains exactly one element.

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

Tests whether the specified collection contains exactly one element.

ContainsSingle<T>(IEnumerable<T>)

Source:
Assert.Contains.cs

Tests whether the specified collection contains exactly one element.

public static T ContainsSingle<T> (System.Collections.Generic.IEnumerable<T> collection);
static member ContainsSingle : seq<'T> -> 'T
Public Shared Function ContainsSingle(Of T) (collection As IEnumerable(Of T)) As T

Type Parameters

T

The type of the collection items.

Parameters

collection
IEnumerable<T>

The collection.

Returns

T

The item.

Applies to

ContainsSingle<T>(IEnumerable<T>, Assert.AssertSingleInterpolatedStringHandler<T>)

Source:
Assert.Contains.cs

Tests whether the specified collection contains exactly one element.

public static T ContainsSingle<T> (System.Collections.Generic.IEnumerable<T> collection, ref Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AssertSingleInterpolatedStringHandler<T> message);
static member ContainsSingle : seq<'T> * AssertSingleInterpolatedStringHandler -> 'T
Public Shared Function ContainsSingle(Of T) (collection As IEnumerable(Of T), ByRef message As Assert.AssertSingleInterpolatedStringHandler(Of T)) As T

Type Parameters

T

The type of the collection items.

Parameters

collection
IEnumerable<T>

The collection.

message
Assert.AssertSingleInterpolatedStringHandler<T>

The message to display when the assertion fails.

Returns

T

The item.

Applies to

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

Source:
Assert.Contains.cs

Tests whether the specified collection contains exactly one element.

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

Type Parameters

T

The type of the collection items.

Parameters

collection
IEnumerable<T>

The collection.

message
String

The message to display when the assertion fails.

Returns

T

The item.

Applies to

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

Source:
Assert.Contains.cs

Tests whether the specified collection contains exactly one element.

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

Type Parameters

T

The type of the collection items.

Parameters

collection
IEnumerable<T>

The collection.

message
String

The message format to display when the assertion fails.

parameters
Object[]

The parameters to format the message.

Returns

T

The item.

Applies to