Matches a string argument if it matches the given regular expression pattern.
Namespace: Moq.Protected
Assembly: Moq (in Moq.dll) Version: 4.0.10827.0 (4.0.0.0)
Syntax
| C# |
|---|
public static Expression IsRegex( string regex, RegexOptions options ) |
Parameters
- regex
- Type: System..::..String
The pattern to use to match the string argument value.
- options
- Type: System.Text.RegularExpressions..::..RegexOptions
The options used to interpret the pattern.
Examples
The following example shows how to expect a call to a method where the
string argument matches the given regular expression, in a case insensitive way:
CopyC#
CopyC#mock.Protected()
.Setup("Check", ItExpr.IsRegex("[a-z]+", RegexOptions.IgnoreCase))
.Returns(1);