Class Assume
Provides static methods to express the assumptions that must be met for a test to give a meaningful result. If an assumption is not met, the test should produce an inconclusive result.
Inherited Members
Namespace: NUnit.Framework
Assembly: nunit.framework.dll
Syntax
public abstract class Assume
Constructors
View SourceAssume()
Declaration
protected Assume()
Methods
View SourceReferenceEquals(object, object)
DO NOT USE! The ReferenceEquals method throws an InvalidOperationException. This is done to make sure there is no mistake by calling this function.
Declaration
public static void ReferenceEquals(object a, object b)
Parameters
Type | Name | Description |
---|---|---|
object | a | The left object. |
object | b | The right object. |
That(bool, NUnitString, string)
Asserts that a condition is true. If the condition is false, the method throws an InconclusiveException.
Declaration
public static void That(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 |
That(bool, FormattableString, string)
Asserts that a condition is true. If the condition is false, the method throws an InconclusiveException.
Declaration
public static void That(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 |
That(bool, Func<string>, string)
Asserts that a condition is true. If the condition is false, the method throws an InconclusiveException.
Declaration
public static void That(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 |
That(Func<bool>, NUnitString, string)
Asserts that a condition is true. If the condition is false, the method throws an InconclusiveException.
Declaration
public static void That(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 |
That(Func<bool>, FormattableString, string)
Asserts that a condition is true. If the condition is false, the method throws an InconclusiveException.
Declaration
public static void That(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 |
That(Func<bool>, Func<string>, string)
Asserts that a condition is true. If the condition is false, the method throws an InconclusiveException.
Declaration
public static void That(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 |
That<TActual>(ActualValueDelegate<TActual>, IResolveConstraint, NUnitString, string, string)
Apply a constraint to an actual value, succeeding if the constraint is satisfied and throwing an InconclusiveException on failure.
Declaration
public static void That<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. |
That<TActual>(ActualValueDelegate<TActual>, IResolveConstraint, FormattableString, string, string)
Apply a constraint to an actual value, succeeding if the constraint is satisfied and throwing an InconclusiveException on failure.
Declaration
public static void That<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. |
That<TActual>(ActualValueDelegate<TActual>, IResolveConstraint, Func<string>, string, string)
Apply a constraint to an actual value, succeeding if the constraint is satisfied and throwing an InconclusiveException on failure.
Declaration
public static void That<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. |
That<TActual>(TActual, IResolveConstraint, NUnitString, string, string)
Apply a constraint to an actual value, succeeding if the constraint is satisfied and throwing an InconclusiveException on failure.
Declaration
public static void That<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. |
That<TActual>(TActual, IResolveConstraint, FormattableString, string, string)
Apply a constraint to an actual value, succeeding if the constraint is satisfied and throwing an InconclusiveException on failure.
Declaration
public static void That<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. |
That<TActual>(TActual, IResolveConstraint, Func<string>, string, string)
Apply a constraint to an actual value, succeeding if the constraint is satisfied and throwing an InconclusiveException on failure.
Declaration
public static void That<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. |