Interface IConstraint
Interface for all constraints
Inherited Members
Namespace: NUnit.Framework.Constraints
Assembly: nunit.framework.dll
Syntax
public interface IConstraint : IResolveConstraint
Properties
View SourceArguments
Arguments provided to this Constraint, for use in formatting the description.
Declaration
object?[] Arguments { get; }
Property Value
| Type | Description |
|---|---|
| object[] |
Builder
The ConstraintBuilder holding this constraint
Declaration
ConstraintBuilder? Builder { get; set; }
Property Value
| Type | Description |
|---|---|
| ConstraintBuilder |
Description
The Description of what this constraint tests, for use in messages and in the ConstraintResult.
Declaration
string Description { get; }
Property Value
| Type | Description |
|---|---|
| string |
DisplayName
The display name of this Constraint for use by ToString().
Declaration
string DisplayName { get; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
View SourceApplyTo<TActual>(ActualValueDelegate<TActual>)
Applies the constraint to an ActualValueDelegate that returns the value to be tested. The default implementation simply evaluates the delegate but derived classes may override it to provide for delayed processing.
Declaration
[Obsolete("Use Func<TActual> instead of ActualValueDelegate<TActual>")]
ConstraintResult ApplyTo<TActual>(ActualValueDelegate<TActual> del)
Parameters
| Type | Name | Description |
|---|---|---|
| ActualValueDelegate<TActual> | del | An ActualValueDelegate |
Returns
| Type | Description |
|---|---|
| ConstraintResult | A ConstraintResult |
Type Parameters
| Name | Description |
|---|---|
| TActual |
ApplyTo<TActual>(Func<TActual>)
Applies the constraint to a func that returns the value to be tested. The default implementation simply evaluates the delegate but derived classes may override it to provide for delayed processing.
Declaration
ConstraintResult ApplyTo<TActual>(Func<TActual> code)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<TActual> | code | A func returning the value to be tested |
Returns
| Type | Description |
|---|---|
| ConstraintResult | A ConstraintResult |
Type Parameters
| Name | Description |
|---|---|
| TActual |
ApplyTo<TActual>(TActual)
Applies the constraint to an actual value, returning a ConstraintResult.
Declaration
ConstraintResult ApplyTo<TActual>(TActual actual)
Parameters
| Type | Name | Description |
|---|---|---|
| TActual | actual | The value to be tested |
Returns
| Type | Description |
|---|---|
| ConstraintResult | A ConstraintResult |
Type Parameters
| Name | Description |
|---|---|
| TActual |