Class RegexConstraint
RegexConstraint can test whether a string matches the pattern provided.
Inherited Members
Namespace: NUnit.Framework.Constraints
Assembly: nunit.framework.dll
Syntax
public class RegexConstraint : Constraint, IConstraint, IResolveConstraint
Constructors
View SourceRegexConstraint(string)
Initializes a new instance of the RegexConstraint class.
Declaration
public RegexConstraint(string pattern)
Parameters
Type | Name | Description |
---|---|---|
string | pattern | The pattern. |
RegexConstraint(Regex)
Initializes a new instance of the RegexConstraint class.
Declaration
public RegexConstraint(Regex regex)
Parameters
Type | Name | Description |
---|---|---|
Regex | regex | The Regex pattern object. |
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 RegexConstraint IgnoreCase { get; }
Property Value
Type | Description |
---|---|
RegexConstraint |
Methods
View SourceApplyTo<TActual>(TActual)
Applies the regex constraint to an actual value, returning a ConstraintResult.
Declaration
public override ConstraintResult ApplyTo<TActual>(TActual actual)
Parameters
Type | Name | Description |
---|---|---|
TActual | actual | The string to be tested. |
Returns
Type | Description |
---|---|
ConstraintResult | True for success, false for failure. |
Type Parameters
Name | Description |
---|---|
TActual |