Class StringConstraint
- Namespace
- NUnit.Framework.Constraints
- Assembly
- nunit.framework.dll
StringConstraint is the abstract base for constraints that operate on strings. It supports the IgnoreCase modifier for string operations.
public abstract class StringConstraint : Constraint, IConstraint, IResolveConstraint
- Inheritance
-
StringConstraint
- Implements
- Derived
- Inherited Members
Constructors
StringConstraint()
Constructs a StringConstraint without an expected value
protected StringConstraint()
StringConstraint(string)
Constructs a StringConstraint given an expected value
protected StringConstraint(string expected)
Parameters
expected
stringThe expected value
Fields
caseInsensitive
Indicates whether tests should be case-insensitive
protected bool caseInsensitive
Field Value
descriptionText
Description of this constraint
protected string descriptionText
Field Value
expected
The expected value
protected string expected
Field Value
Properties
Description
The Description of what this constraint tests, for use in messages and in the ConstraintResult.
public override string Description { get; }
Property Value
IgnoreCase
Modify the constraint to ignore case in matching.
public StringConstraint IgnoreCase { get; }
Property Value
Methods
ApplyTo<TActual>(TActual)
Test whether the constraint is satisfied by a given value
public override ConstraintResult ApplyTo<TActual>(TActual actual)
Parameters
actual
TActualThe value to be tested
Returns
- ConstraintResult
True for success, false for failure
Type Parameters
TActual
Matches(string)
Test whether the constraint is satisfied by a given string
protected abstract bool Matches(string actual)
Parameters
actual
stringThe string to be tested
Returns
- bool
True for success, false for failure