Share via


Assert.IsNegative Method

Definition

Overloads

IsNegative<T>(T, String)

Tests whether the specified value is negative and throws an exception if it is not.

IsNegative<T>(T, String, String)

Tests whether the specified value is negative and throws an exception if it is not.

IsNegative<T>(T, String)

Source:
Assert.IComparable.cs
Source:
Assert.IComparable.cs

Tests whether the specified value is negative and throws an exception if it is not.

public static void IsNegative<T>(T value, string message = "") where T : struct;
static member IsNegative : 'T * string -> unit (requires 'T : struct)
Public Shared Sub IsNegative(Of T As Structure) (value As T, Optional message As String = "")

Type Parameters

T

The type of value to test.

Parameters

value
T

The value to test.

message
String

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

Exceptions

Thrown if value is not negative.

Applies to

IsNegative<T>(T, String, String)

Source:
Assert.IComparable.cs

Tests whether the specified value is negative and throws an exception if it is not.

public static void IsNegative<T>(T value, string? message = "", string valueExpression = "") where T : struct;
static member IsNegative : 'T * string * string -> unit (requires 'T : struct)
Public Shared Sub IsNegative(Of T As Structure) (value As T, Optional message As String = "", Optional valueExpression As String = "")

Type Parameters

T

The type of value to test.

Parameters

value
T

The value to test.

message
String

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

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

Thrown if value is not negative.

Applies to