Sdílet prostřednictvím


Assert.IsTrue Method

Definition

Overloads

IsTrue(Boolean, String)

Tests whether the specified condition is true and throws an exception if the condition is false.

IsTrue()

Tests whether the specified condition is true and throws an exception if the condition is false.

IsTrue(Boolean)

Tests whether the specified condition is true and throws an exception if the condition is false.

IsTrue(Boolean, String, Object[])

Tests whether the specified condition is true and throws an exception if the condition is false.

IsTrue(Boolean, String)

Tests whether the specified condition is true and throws an exception if the condition is false.

public:
 static void IsTrue(bool condition, System::String ^ message);
public static void IsTrue (bool condition, string message);
static member IsTrue : bool * string -> unit
Public Shared Sub IsTrue (condition As Boolean, message As String)

Parameters

condition
Boolean

The condition the test expects to be true.

message
String

The message to include in the exception when condition is false. The message is shown in test results.

Exceptions

Thrown if condition is false.

Applies to

IsTrue()

Tests whether the specified condition is true and throws an exception if the condition is false.

public:
 static void IsTrue(Nullable<bool> condition, System::String ^ message);
public static void IsTrue (bool? condition, string message);
static member IsTrue : Nullable<bool> * string -> unit
Public Shared Sub IsTrue (condition As Nullable(Of Boolean), message As String)

Exceptions

Thrown if condition is false.

Applies to

IsTrue(Boolean)

Tests whether the specified condition is true and throws an exception if the condition is false.

public:
 static void IsTrue(bool condition);
public static void IsTrue (bool condition);
static member IsTrue : bool -> unit
Public Shared Sub IsTrue (condition As Boolean)

Parameters

condition
Boolean

The condition the test expects to be true.

Exceptions

Thrown if condition is false.

Applies to

IsTrue(Boolean, String, Object[])

Tests whether the specified condition is true and throws an exception if the condition is false.

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

Parameters

condition
Boolean

The condition the test expects to be true.

message
String

The message to include in the exception when condition is false. The message is shown in test results.

parameters
Object[]

An array of parameters to use when formatting message.

Exceptions

Thrown if condition is false.

Applies to