Share via


Assert.IsLessThan Method

Definition

Overloads

IsLessThan<T>(T, T, String)

Tests whether the value is less than the upper bound and throws an exception if it is not.

IsLessThan<T>(T, T, String, String, String)

Tests whether the value is less than the upper bound and throws an exception if it is not.

IsLessThan<T>(T, T, String)

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

Tests whether the value is less than the upper bound and throws an exception if it is not.

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

Type Parameters

T

The type of values to compare.

Parameters

upperBound
T

The upper bound value that the value should be less than.

value
T

The value to compare. This is the value produced by the code under test.

message
String

The message to include in the exception when value is not less than upperBound. The message is shown in test results.

Exceptions

Thrown if value is not less than upperBound.

Applies to

IsLessThan<T>(T, T, String, String, String)

Source:
Assert.IComparable.cs

Tests whether the value is less than the upper bound and throws an exception if it is not.

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

Type Parameters

T

The type of values to compare.

Parameters

upperBound
T

The upper bound value that the value should be less than.

value
T

The value to compare. This is the value produced by the code under test.

message
String

The message to include in the exception when value is not less than upperBound. The message is shown in test results.

upperBoundExpression
String

The syntactic expression of upperBound 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

Thrown if value is not less than upperBound.

Applies to