Share via


Assert.HasCount Method

Definition

Overloads

HasCount(Int32, IEnumerable, String)

Tests whether the collection has the expected count/length.

HasCount(Int32, IEnumerable, String, String)

Tests whether the collection has the expected count/length.

HasCount(Int32, IEnumerable)

Tests whether the collection has the expected count/length.

HasCount<T>(Int32, IEnumerable<T>)

Tests whether the collection has the expected count/length.

HasCount<T>(Int32, IEnumerable<T>, Assert.AssertCountInterpolatedStringHandler<T>)

Tests whether the collection has the expected count/length.

HasCount<T>(Int32, IEnumerable<T>, String)

Tests whether the collection has the expected count/length.

HasCount<T>(Int32, IEnumerable<T>, Assert.AssertCountInterpolatedStringHandler<T>, String)

Tests whether the collection has the expected count/length.

HasCount<T>(Int32, IEnumerable<T>, String, Object[])

Tests whether the collection has the expected count/length.

HasCount<T>(Int32, IEnumerable<T>, String, String)

Tests whether the collection has the expected count/length.

HasCount(Int32, IEnumerable, String)

Source:
Assert.Count.cs

Tests whether the collection has the expected count/length.

public static void HasCount(int expected, System.Collections.IEnumerable collection, string? message);
static member HasCount : int * System.Collections.IEnumerable * string -> unit
Public Shared Sub HasCount (expected As Integer, collection As IEnumerable, message As String)

Parameters

expected
Int32

The expected count.

collection
IEnumerable

The collection.

message
String

The message format to display when the assertion fails.

Applies to

HasCount(Int32, IEnumerable, String, String)

Source:
Assert.Count.cs

Tests whether the collection has the expected count/length.

public static void HasCount(int expected, System.Collections.IEnumerable collection, string? message = "", string collectionExpression = "");
static member HasCount : int * System.Collections.IEnumerable * string * string -> unit
Public Shared Sub HasCount (expected As Integer, collection As IEnumerable, Optional message As String = "", Optional collectionExpression As String = "")

Parameters

expected
Int32

The expected count.

collection
IEnumerable

The collection.

message
String

The message to display when the assertion fails.

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

HasCount(Int32, IEnumerable)

Source:
Assert.Count.cs

Tests whether the collection has the expected count/length.

public static void HasCount(int expected, System.Collections.IEnumerable collection);
static member HasCount : int * System.Collections.IEnumerable -> unit
Public Shared Sub HasCount (expected As Integer, collection As IEnumerable)

Parameters

expected
Int32

The expected count.

collection
IEnumerable

The collection.

Applies to

HasCount<T>(Int32, IEnumerable<T>)

Source:
Assert.Count.cs
Source:
Assert.Count.cs
Source:
Assert.Count.cs
Source:
Assert.Count.cs

Tests whether the collection has the expected count/length.

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

Type Parameters

T

The type of the collection items.

Parameters

expected
Int32

The expected count.

collection
IEnumerable<T>

The collection.

Applies to

HasCount<T>(Int32, IEnumerable<T>, Assert.AssertCountInterpolatedStringHandler<T>)

Source:
Assert.Count.cs
Source:
Assert.Count.cs
Source:
Assert.Count.cs
Source:
Assert.Count.cs

Tests whether the collection has the expected count/length.

public static void HasCount<T>(int expected, System.Collections.Generic.IEnumerable<T> collection, ref Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AssertCountInterpolatedStringHandler<T> message);
static member HasCount : int * seq<'T> * AssertCountInterpolatedStringHandler -> unit
Public Shared Sub HasCount(Of T) (expected As Integer, collection As IEnumerable(Of T), ByRef message As Assert.AssertCountInterpolatedStringHandler(Of T))

Type Parameters

T

The type of the collection items.

Parameters

expected
Int32

The expected count.

collection
IEnumerable<T>

The collection.

message
Assert.AssertCountInterpolatedStringHandler<T>

The message to display when the assertion fails.

Applies to

HasCount<T>(Int32, IEnumerable<T>, String)

Source:
Assert.Count.cs
Source:
Assert.Count.cs
Source:
Assert.Count.cs
Source:
Assert.Count.cs

Tests whether the collection has the expected count/length.

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

Type Parameters

T

The type of the collection items.

Parameters

expected
Int32

The expected count.

collection
IEnumerable<T>

The collection.

message
String

The message to display when the assertion fails.

Applies to

HasCount<T>(Int32, IEnumerable<T>, Assert.AssertCountInterpolatedStringHandler<T>, String)

Source:
Assert.Count.cs

Tests whether the collection has the expected count/length.

public static void HasCount<T>(int expected, System.Collections.Generic.IEnumerable<T> collection, ref Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AssertCountInterpolatedStringHandler<T> message, string collectionExpression = "");
static member HasCount : int * seq<'T> * AssertCountInterpolatedStringHandler * string -> unit
Public Shared Sub HasCount(Of T) (expected As Integer, collection As IEnumerable(Of T), ByRef message As Assert.AssertCountInterpolatedStringHandler(Of T), Optional collectionExpression As String = "")

Type Parameters

T

The type of the collection items.

Parameters

expected
Int32

The expected count.

collection
IEnumerable<T>

The collection.

message
Assert.AssertCountInterpolatedStringHandler<T>

The message to display when the assertion fails.

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

HasCount<T>(Int32, IEnumerable<T>, String, Object[])

Source:
Assert.Count.cs
Source:
Assert.Count.cs
Source:
Assert.Count.cs
Source:
Assert.Count.cs

Tests whether the collection has the expected count/length.

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

Type Parameters

T

The type of the collection items.

Parameters

expected
Int32

The expected count.

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

HasCount<T>(Int32, IEnumerable<T>, String, String)

Source:
Assert.Count.cs

Tests whether the collection has the expected count/length.

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

Type Parameters

T

The type of the collection items.

Parameters

expected
Int32

The expected count.

collection
IEnumerable<T>

The collection.

message
String

The message to display when the assertion fails.

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