Assert.IsPositive Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| IsPositive<T>(T, String) |
Tests whether the specified value is positive and throws an exception if it is not. |
| IsPositive<T>(T, String, String) |
Tests whether the specified value is positive and throws an exception if it is not. |
IsPositive<T>(T, String)
- Source:
- Assert.IComparable.cs
- Source:
- Assert.IComparable.cs
Tests whether the specified value is positive and throws an exception if it is not.
public static void IsPositive<T>(T value, string message = "") where T : struct;
static member IsPositive : 'T * string -> unit (requires 'T : struct)
Public Shared Sub IsPositive(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 positive. The message is shown in test results.
Exceptions
Thrown if value is not positive.
Applies to
IsPositive<T>(T, String, String)
- Source:
- Assert.IComparable.cs
Tests whether the specified value is positive and throws an exception if it is not.
public static void IsPositive<T>(T value, string? message = "", string valueExpression = "") where T : struct;
static member IsPositive : 'T * string * string -> unit (requires 'T : struct)
Public Shared Sub IsPositive(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 positive. 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 positive.