Class Warn
Provides static methods to express conditions that must be met for the test to succeed. If any test fails, a warning is issued.
Inherited Members
Namespace: NUnit.Framework
Assembly: nunit.framework.dll
Syntax
public abstract class Warn
Constructors
View SourceWarn()
Declaration
protected Warn()
Methods
View SourceIf(bool, NUnitString, string)
Asserts that a condition is false. If the condition is true, a warning is issued.
Declaration
public static void If(bool condition, NUnitString message = default, string actualExpression = "")
Parameters
Type | Name | Description |
---|---|---|
bool | condition | The evaluated condition |
NUnitString | message | The message to display if the condition is false |
string | actualExpression |
If(bool, FormattableString, string)
Asserts that a condition is false. If the condition is true, a warning is issued.
Declaration
public static void If(bool condition, FormattableString message, string actualExpression = "")
Parameters
Type | Name | Description |
---|---|---|
bool | condition | The evaluated condition |
FormattableString | message | The message to display if the condition is false |
string | actualExpression |
If(bool, Func<string>, string)
Asserts that a condition is false. If the condition is true, a warning is issued.
Declaration
public static void If(bool condition, Func<string> getExceptionMessage, string actualExpression = "")
Parameters
Type | Name | Description |
---|---|---|
bool | condition | The evaluated condition |
Func<string> | getExceptionMessage | A function to build the message included with the Exception |
string | actualExpression |
If(Func<bool>, NUnitString, string)
Asserts that a condition is false. If the condition is true a warning is issued.
Declaration
public static void If(Func<bool> condition, NUnitString message = default, string actualExpression = "")
Parameters
Type | Name | Description |
---|---|---|
Func<bool> | condition | A lambda that returns a Boolean |
NUnitString | message | The message to display if the condition is true |
string | actualExpression |
If(Func<bool>, FormattableString, string)
Asserts that a condition is false. If the condition is true a warning is issued.
Declaration
public static void If(Func<bool> condition, FormattableString message, string actualExpression = "")
Parameters
Type | Name | Description |
---|---|---|
Func<bool> | condition | A lambda that returns a Boolean |
FormattableString | message | The message to display if the condition is true |
string | actualExpression |
If(Func<bool>, Func<string>, string)
Asserts that a condition is false. If the condition is true a warning is issued.
Declaration
public static void If(Func<bool> condition, Func<string> getExceptionMessage, string actualExpression = "")
Parameters
Type | Name | Description |
---|---|---|
Func<bool> | condition | A lambda that returns a Boolean |
Func<string> | getExceptionMessage | A function to build the message included with the Exception |
string | actualExpression |
If<TActual>(ActualValueDelegate<TActual>, IResolveConstraint, NUnitString, string, string)
Apply a constraint to an actual value, succeeding if the constraint fails and issuing a warning on success.
Declaration
public static void If<TActual>(ActualValueDelegate<TActual> del, IResolveConstraint expr, NUnitString message = default, string actualExpression = "", string constraintExpression = "")
Parameters
Type | Name | Description |
---|---|---|
ActualValueDelegate<TActual> | del | An ActualValueDelegate returning the value to be tested |
IResolveConstraint | expr | A Constraint expression to be applied |
NUnitString | message | The message that will be displayed on failure |
string | actualExpression | |
string | constraintExpression |
Type Parameters
Name | Description |
---|---|
TActual | The Type being compared. |
If<TActual>(ActualValueDelegate<TActual>, IResolveConstraint, FormattableString, string, string)
Apply a constraint to an actual value, succeeding if the constraint fails and issuing a warning on success.
Declaration
public static void If<TActual>(ActualValueDelegate<TActual> del, IResolveConstraint expr, FormattableString message, string actualExpression = "", string constraintExpression = "")
Parameters
Type | Name | Description |
---|---|---|
ActualValueDelegate<TActual> | del | An ActualValueDelegate returning the value to be tested |
IResolveConstraint | expr | A Constraint expression to be applied |
FormattableString | message | The message that will be displayed on failure |
string | actualExpression | |
string | constraintExpression |
Type Parameters
Name | Description |
---|---|
TActual | The Type being compared. |
If<TActual>(ActualValueDelegate<TActual>, IResolveConstraint, Func<string>, string, string)
Apply a constraint to an actual value, succeeding if the constraint fails and issuing a warning on failure.
Declaration
public static void If<TActual>(ActualValueDelegate<TActual> del, IResolveConstraint expr, Func<string> getExceptionMessage, string actualExpression = "", string constraintExpression = "")
Parameters
Type | Name | Description |
---|---|---|
ActualValueDelegate<TActual> | del | An ActualValueDelegate returning the value to be tested |
IResolveConstraint | expr | A Constraint expression to be applied |
Func<string> | getExceptionMessage | A function to build the message included with the Exception |
string | actualExpression | |
string | constraintExpression |
Type Parameters
Name | Description |
---|---|
TActual | The Type being compared. |
If<TActual>(TActual, IResolveConstraint, NUnitString, string, string)
Apply a constraint to an actual value, succeeding if the constraint fails and issuing a warning if it succeeds.
Declaration
public static void If<TActual>(TActual actual, IResolveConstraint expression, NUnitString message = default, string actualExpression = "", string constraintExpression = "")
Parameters
Type | Name | Description |
---|---|---|
TActual | actual | The actual value to test |
IResolveConstraint | expression | A Constraint expression to be applied |
NUnitString | message | The message that will be displayed on failure |
string | actualExpression | |
string | constraintExpression |
Type Parameters
Name | Description |
---|---|
TActual | The Type being compared. |
If<TActual>(TActual, IResolveConstraint, FormattableString, string, string)
Apply a constraint to an actual value, succeeding if the constraint fails and issuing a warning if it succeeds.
Declaration
public static void If<TActual>(TActual actual, IResolveConstraint expression, FormattableString message, string actualExpression = "", string constraintExpression = "")
Parameters
Type | Name | Description |
---|---|---|
TActual | actual | The actual value to test |
IResolveConstraint | expression | A Constraint expression to be applied |
FormattableString | message | The message that will be displayed on failure |
string | actualExpression | |
string | constraintExpression |
Type Parameters
Name | Description |
---|---|
TActual | The Type being compared. |
If<TActual>(TActual, IResolveConstraint, Func<string>, string, string)
Apply a constraint to an actual value, succeeding if the constraint is satisfied and issuing a warning on failure.
Declaration
public static void If<TActual>(TActual actual, IResolveConstraint expression, Func<string> getExceptionMessage, string actualExpression = "", string constraintExpression = "")
Parameters
Type | Name | Description |
---|---|---|
TActual | actual | The actual value to test |
IResolveConstraint | expression | A Constraint expression to be applied |
Func<string> | getExceptionMessage | A function to build the message included with the Exception |
string | actualExpression | |
string | constraintExpression |
Type Parameters
Name | Description |
---|---|
TActual | The Type being compared. |
Unless(bool, NUnitString, string)
Asserts that a condition is true. If the condition is false, a warning is issued.
Declaration
public static void Unless(bool condition, NUnitString message = default, string actualExpression = "")
Parameters
Type | Name | Description |
---|---|---|
bool | condition | The evaluated condition |
NUnitString | message | The message to display if the condition is false |
string | actualExpression |
Unless(bool, FormattableString, string)
Asserts that a condition is true. If the condition is false, a warning is issued.
Declaration
public static void Unless(bool condition, FormattableString message, string actualExpression = "")
Parameters
Type | Name | Description |
---|---|---|
bool | condition | The evaluated condition |
FormattableString | message | The message to display if the condition is false |
string | actualExpression |
Unless(bool, Func<string>, string)
Asserts that a condition is true. If the condition is false, a warning is issued.
Declaration
public static void Unless(bool condition, Func<string> getExceptionMessage, string actualExpression = "")
Parameters
Type | Name | Description |
---|---|---|
bool | condition | The evaluated condition |
Func<string> | getExceptionMessage | A function to build the message included with the Exception |
string | actualExpression |
Unless(Func<bool>, NUnitString, string)
Asserts that a condition is true. If the condition is false, a warning is issued.
Declaration
public static void Unless(Func<bool> condition, NUnitString message = default, string actualExpression = "")
Parameters
Type | Name | Description |
---|---|---|
Func<bool> | condition | A lambda that returns a Boolean |
NUnitString | message | The message to display if the condition is false |
string | actualExpression |
Unless(Func<bool>, FormattableString, string)
Asserts that a condition is true. If the condition is false, a warning is issued.
Declaration
public static void Unless(Func<bool> condition, FormattableString message, string actualExpression = "")
Parameters
Type | Name | Description |
---|---|---|
Func<bool> | condition | A lambda that returns a Boolean |
FormattableString | message | The message to display if the condition is false |
string | actualExpression |
Unless(Func<bool>, Func<string>, string)
Asserts that a condition is true. If the condition is false, a warning is issued.
Declaration
public static void Unless(Func<bool> condition, Func<string> getExceptionMessage, string actualExpression = "")
Parameters
Type | Name | Description |
---|---|---|
Func<bool> | condition | A lambda that returns a Boolean |
Func<string> | getExceptionMessage | A function to build the message included with the Exception |
string | actualExpression |
Unless<TActual>(ActualValueDelegate<TActual>, IResolveConstraint, NUnitString, string, string)
Apply a constraint to an actual value, succeeding if the constraint is satisfied and issuing a warning on failure.
Declaration
public static void Unless<TActual>(ActualValueDelegate<TActual> del, IResolveConstraint expr, NUnitString message = default, string actualExpression = "", string constraintExpression = "")
Parameters
Type | Name | Description |
---|---|---|
ActualValueDelegate<TActual> | del | An ActualValueDelegate returning the value to be tested |
IResolveConstraint | expr | A Constraint expression to be applied |
NUnitString | message | The message that will be displayed on failure |
string | actualExpression | |
string | constraintExpression |
Type Parameters
Name | Description |
---|---|
TActual | The Type being compared. |
Unless<TActual>(ActualValueDelegate<TActual>, IResolveConstraint, FormattableString, string, string)
Apply a constraint to an actual value, succeeding if the constraint is satisfied and issuing a warning on failure.
Declaration
public static void Unless<TActual>(ActualValueDelegate<TActual> del, IResolveConstraint expr, FormattableString message, string actualExpression = "", string constraintExpression = "")
Parameters
Type | Name | Description |
---|---|---|
ActualValueDelegate<TActual> | del | An ActualValueDelegate returning the value to be tested |
IResolveConstraint | expr | A Constraint expression to be applied |
FormattableString | message | The message that will be displayed on failure |
string | actualExpression | |
string | constraintExpression |
Type Parameters
Name | Description |
---|---|
TActual | The Type being compared. |
Unless<TActual>(ActualValueDelegate<TActual>, IResolveConstraint, Func<string>, string, string)
Apply a constraint to an actual value, succeeding if the constraint is satisfied and issuing a warning on failure.
Declaration
public static void Unless<TActual>(ActualValueDelegate<TActual> del, IResolveConstraint expr, Func<string> getExceptionMessage, string actualExpression = "", string constraintExpression = "")
Parameters
Type | Name | Description |
---|---|---|
ActualValueDelegate<TActual> | del | An ActualValueDelegate returning the value to be tested |
IResolveConstraint | expr | A Constraint expression to be applied |
Func<string> | getExceptionMessage | A function to build the message included with the Exception |
string | actualExpression | |
string | constraintExpression |
Type Parameters
Name | Description |
---|---|
TActual | The Type being compared. |
Unless<TActual>(TActual, IResolveConstraint, NUnitString, string, string)
Apply a constraint to an actual value, succeeding if the constraint is satisfied and issuing a warning on failure.
Declaration
public static void Unless<TActual>(TActual actual, IResolveConstraint expression, NUnitString message = default, string actualExpression = "", string constraintExpression = "")
Parameters
Type | Name | Description |
---|---|---|
TActual | actual | The actual value to test |
IResolveConstraint | expression | A Constraint expression to be applied |
NUnitString | message | The message that will be displayed on failure |
string | actualExpression | |
string | constraintExpression |
Type Parameters
Name | Description |
---|---|
TActual | The Type being compared. |
Unless<TActual>(TActual, IResolveConstraint, FormattableString, string, string)
Apply a constraint to an actual value, succeeding if the constraint is satisfied and issuing a warning on failure.
Declaration
public static void Unless<TActual>(TActual actual, IResolveConstraint expression, FormattableString message, string actualExpression = "", string constraintExpression = "")
Parameters
Type | Name | Description |
---|---|---|
TActual | actual | The actual value to test |
IResolveConstraint | expression | A Constraint expression to be applied |
FormattableString | message | The message that will be displayed on failure |
string | actualExpression | |
string | constraintExpression |
Type Parameters
Name | Description |
---|---|
TActual | The Type being compared. |
Unless<TActual>(TActual, IResolveConstraint, Func<string>, string, string)
Apply a constraint to an actual value, succeeding if the constraint is satisfied and issuing a warning on failure.
Declaration
public static void Unless<TActual>(TActual actual, IResolveConstraint expression, Func<string> getExceptionMessage, string actualExpression = "", string constraintExpression = "")
Parameters
Type | Name | Description |
---|---|---|
TActual | actual | The actual value to test |
IResolveConstraint | expression | A Constraint expression to be applied |
Func<string> | getExceptionMessage | A function to build the message included with the Exception |
string | actualExpression | |
string | constraintExpression |
Type Parameters
Name | Description |
---|---|
TActual | The Type being compared. |