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
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>(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 |
ApplyTo<TActual>(ref TActual)
Test whether the constraint is satisfied by a given reference. The default implementation simply dereferences the value but derived classes may override it to provide for delayed processing.
Declaration
[Obsolete("This was never implemented and will be removed.")]
ConstraintResult ApplyTo<TActual>(ref TActual actual)
Parameters
| Type | Name | Description |
|---|---|---|
| TActual | actual | A reference to the value to be tested |
Returns
| Type | Description |
|---|---|
| ConstraintResult | A ConstraintResult |
Type Parameters
| Name | Description |
|---|---|
| TActual |