Assert.IsTrue Method

Definition

Overloads

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

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(Nullable<Boolean>, String)

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(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(Boolean, String)

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

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

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

C#
public static void IsTrue(bool? condition, string message, params object[] parameters);
C#
public static void IsTrue(bool? condition, string? message, params object?[]? parameters);

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(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

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

C#
public static void IsTrue(bool condition, string message, params object[] parameters);
C#
public static void IsTrue(bool condition, string? message, params object?[]? parameters);

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

Visual Studio SDK 2022 i druge verzije
Proizvod Verzije
Visual Studio SDK 2017, 2019, 2022

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

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

C#
public static void IsTrue(bool? condition, string message);
C#
public static void IsTrue(bool? condition, string? message);

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

Source:
Assert.IsTrue.cs

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

C#
public static void IsTrue(bool? condition, ref Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AssertIsTrueInterpolatedStringHandler message);

Parameters

condition
Nullable<Boolean>

The condition the test expects to be true.

message
Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AssertIsTrueInterpolatedStringHandler

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

Applies to

IsTrue(Boolean, Assert+AssertIsTrueInterpolatedStringHandler)

Source:
Assert.IsTrue.cs

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

C#
public static void IsTrue(bool condition, ref Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AssertIsTrueInterpolatedStringHandler message);

Parameters

condition
Boolean

The condition the test expects to be true.

message
Microsoft.VisualStudio.TestTools.UnitTesting.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

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

C#
public static void IsTrue(bool? condition);

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

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

C#
public static void IsTrue(bool condition);

Parameters

condition
Boolean

The condition the test expects to be true.

Exceptions

Thrown if condition is false.

Applies to

Visual Studio SDK 2022 i druge verzije
Proizvod Verzije
Visual Studio SDK 2017, 2019, 2022

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

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

C#
public static void IsTrue(bool condition, string message);
C#
public static void IsTrue(bool condition, string? message);

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

Visual Studio SDK 2022 i druge verzije
Proizvod Verzije
Visual Studio SDK 2017, 2019, 2022