Condividi tramite


Assert.IsNotNull Method

Definition

Overloads

IsNotNull(Object, String, Object[])

Tests whether the specified object is non-null and throws an exception if it is null.

IsNotNull(Object, String)

Tests whether the specified object is non-null and throws an exception if it is null.

IsNotNull(Object)

Tests whether the specified object is non-null and throws an exception if it is null.

IsNotNull(Object, String, Object[])

Tests whether the specified object is non-null and throws an exception if it is null.

public:
 static void IsNotNull(System::Object ^ value, System::String ^ message, ... cli::array <System::Object ^> ^ parameters);
public static void IsNotNull (object value, string message, params object[] parameters);
static member IsNotNull : obj * string * obj[] -> unit
Public Shared Sub IsNotNull (value As Object, message As String, ParamArray parameters As Object())

Parameters

value
Object

The object the test expects not to be null.

message
String

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

parameters
Object[]

An array of parameters to use when formatting message.

Exceptions

Thrown if value is null.

Applies to

IsNotNull(Object, String)

Tests whether the specified object is non-null and throws an exception if it is null.

public:
 static void IsNotNull(System::Object ^ value, System::String ^ message);
public static void IsNotNull (object value, string message);
static member IsNotNull : obj * string -> unit
Public Shared Sub IsNotNull (value As Object, message As String)

Parameters

value
Object

The object the test expects not to be null.

message
String

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

Exceptions

Thrown if value is null.

Applies to

IsNotNull(Object)

Tests whether the specified object is non-null and throws an exception if it is null.

public:
 static void IsNotNull(System::Object ^ value);
public static void IsNotNull (object value);
static member IsNotNull : obj -> unit
Public Shared Sub IsNotNull (value As Object)

Parameters

value
Object

The object the test expects not to be null.

Exceptions

Thrown if value is null.

Applies to