Share via


Assert.IsTrue Method

Definition

Overloads

IsTrue(Nullable<Boolean>, String, String)

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

IsTrue(Nullable<Boolean>, String, Object[])

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

IsTrue(Nullable<Boolean>, Assert+AssertIsTrueInterpolatedStringHandler, String)

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

IsTrue(Nullable<Boolean>, String)

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.

IsTrue(Boolean, Assert+AssertIsTrueInterpolatedStringHandler)

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

IsTrue(Nullable<Boolean>)

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(Nullable<Boolean>, Assert+AssertIsTrueInterpolatedStringHandler)

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

IsTrue(Nullable<Boolean>, String, String)

Source:
Assert.IsTrue.cs

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

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

Parameters

condition
Nullable<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.

conditionExpression
String

The syntactic expression of condition as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.

Exceptions

Thrown if condition is false.

Applies to

IsTrue(Nullable<Boolean>, String, Object[])

Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs

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

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

Parameters

condition
Nullable<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

IsTrue(Nullable<Boolean>, Assert+AssertIsTrueInterpolatedStringHandler, String)

Source:
Assert.IsTrue.cs

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

public static void IsTrue(bool? condition, ref Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AssertIsTrueInterpolatedStringHandler message, string conditionExpression = "");
static member IsTrue : Nullable<bool> * AssertIsTrueInterpolatedStringHandler * string -> unit
Public Shared Sub IsTrue (condition As Nullable(Of Boolean), ByRef message As Assert.AssertIsTrueInterpolatedStringHandler, Optional conditionExpression As String = "")

Parameters

condition
Nullable<Boolean>

The condition the test expects to be true.

message
Assert.AssertIsTrueInterpolatedStringHandler

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

conditionExpression
String

The syntactic expression of condition as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.

Applies to

IsTrue(Nullable<Boolean>, String)

Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs

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

public static void IsTrue(bool? condition, 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)

Parameters

condition
Nullable<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(Boolean, String, Object[])

Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs

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

public static void IsTrue(bool condition, string message, params 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

IsTrue(Boolean, String)

Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs

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

public static void IsTrue(bool condition, 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(Boolean, Assert+AssertIsTrueInterpolatedStringHandler)

Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs

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

public static void IsTrue(bool condition, ref Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AssertIsTrueInterpolatedStringHandler message);
static member IsTrue : bool * AssertIsTrueInterpolatedStringHandler -> unit
Public Shared Sub IsTrue (condition As Boolean, ByRef message As Assert.AssertIsTrueInterpolatedStringHandler)

Parameters

condition
Boolean

The condition the test expects to be true.

message
Assert.AssertIsTrueInterpolatedStringHandler

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

Applies to

IsTrue(Nullable<Boolean>)

Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs

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

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

Parameters

condition
Nullable<Boolean>

The condition the test expects to be true.

Exceptions

Thrown if condition is false.

Applies to

IsTrue(Boolean)

Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs

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

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(Nullable<Boolean>, Assert+AssertIsTrueInterpolatedStringHandler)

Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs
Source:
Assert.IsTrue.cs

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

public static void IsTrue(bool? condition, ref Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AssertIsTrueInterpolatedStringHandler message);
static member IsTrue : Nullable<bool> * AssertIsTrueInterpolatedStringHandler -> unit
Public Shared Sub IsTrue (condition As Nullable(Of Boolean), ByRef message As Assert.AssertIsTrueInterpolatedStringHandler)

Parameters

condition
Nullable<Boolean>

The condition the test expects to be true.

message
Assert.AssertIsTrueInterpolatedStringHandler

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

Applies to