Skip to content

RegexConstraint

Chris Maddock edited this page May 27, 2017 · 7 revisions

RegexConstraint tests that a pattern is matched.

Constructor

RegexConstraint(string pattern)

Syntax

Does.Match(string pattern)
Matches(string pattern)

Modifiers

...IgnoreCase

Examples of Use

string phrase = "Make your tests fail before passing!"

Assert.That( phrase, Does.Match( "Make.*tests.*pass" ) );
Assert.That( phrase, Does.Not.Match( "your.*passing.*tests" ) );
Expect( phrase, Matches( "Make.*pass" ) );

Notes

1. Matches may appear only in the body of a constraint expression or when the inherited syntax is used.
Clone this wiki locally