Assert.HasCount Method

Definition

Overloads

Name Description
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, ReadOnlySpan<T>, String, String)

Tests whether the span has the expected count/length.

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

Tests whether the span has the expected count/length.

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

Tests whether the span has the expected count/length.

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

Tests whether the memory has the expected count/length.

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

Tests whether the span has the expected count/length.

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

Tests whether the memory has the expected count/length.

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

Tests whether the memory has the expected count/length.

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

Tests whether the memory has the expected count/length.

HasCount<T>(Int32, IEnumerable<T>, String, 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>, Assert.AssertCountInterpolatedStringHandler<T>, String)

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>)

Tests whether the collection has the expected count/length.

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

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
Source:
Assert.Count.cs
Source:
Assert.Count.cs
Source:
Assert.HasCount.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, ReadOnlySpan<T>, String, String)

Source:
Assert.HasCount.cs

Tests whether the span has the expected count/length.

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

Type Parameters

T

The type of the span items.

Parameters

expected
Int32

The expected count.

collection
ReadOnlySpan<T>

The span.

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<T>(Int32, ReadOnlySpan<T>, Assert.AssertCountInterpolatedStringHandler<T>, String)

Source:
Assert.HasCount.cs

Tests whether the span has the expected count/length.

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

Type Parameters

T

The type of the span items.

Parameters

expected
Int32

The expected count.

collection
ReadOnlySpan<T>

The span.

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, Span<T>, String, String)

Source:
Assert.HasCount.cs

Tests whether the span has the expected count/length.

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

Type Parameters

T

The type of the span items.

Parameters

expected
Int32

The expected count.

collection
Span<T>

The span.

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<T>(Int32, ReadOnlyMemory<T>, String, String)

Source:
Assert.HasCount.cs

Tests whether the memory has the expected count/length.

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

Type Parameters

T

The type of the memory items.

Parameters

expected
Int32

The expected count.

collection
ReadOnlyMemory<T>

The memory.

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<T>(Int32, Span<T>, Assert.AssertCountInterpolatedStringHandler<T>, String)

Source:
Assert.HasCount.cs

Tests whether the span has the expected count/length.

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

Type Parameters

T

The type of the span items.

Parameters

expected
Int32

The expected count.

collection
Span<T>

The span.

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, ReadOnlyMemory<T>, Assert.AssertCountInterpolatedStringHandler<T>, String)

Source:
Assert.HasCount.cs

Tests whether the memory has the expected count/length.

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

Type Parameters

T

The type of the memory items.

Parameters

expected
Int32

The expected count.

collection
ReadOnlyMemory<T>

The memory.

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, Memory<T>, String, String)

Source:
Assert.HasCount.cs

Tests whether the memory has the expected count/length.

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

Type Parameters

T

The type of the memory items.

Parameters

expected
Int32

The expected count.

collection
Memory<T>

The memory.

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<T>(Int32, Memory<T>, Assert.AssertCountInterpolatedStringHandler<T>, String)

Source:
Assert.HasCount.cs

Tests whether the memory has the expected count/length.

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

Type Parameters

T

The type of the memory items.

Parameters

expected
Int32

The expected count.

collection
Memory<T>

The memory.

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, String)

Source:
Assert.Count.cs
Source:
Assert.Count.cs
Source:
Assert.Count.cs
Source:
Assert.HasCount.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

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>, Assert.AssertCountInterpolatedStringHandler<T>, String)

Source:
Assert.Count.cs
Source:
Assert.Count.cs
Source:
Assert.Count.cs
Source:
Assert.HasCount.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)

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>)

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>)

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