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