IsRegex Method ()

Moq 2.6

Matches a string argument if it matches the given regular expression pattern.

Namespace:  Moq.Protected
Assembly:  Moq (in Moq.dll) Version: 2.6.1014.1 (2.6.0.0)

Syntax

C#
public static Expression IsRegex(
	string regex
)

Parameters

regex
Type: String
The pattern to use to match the string argument value.

Examples

The following example shows how to expect a call to a method where the string argument matches the given regular expression:
CopyC#
mock.Protected()
    .Expect("Check", ItExpr.IsRegex("[a-z]+"))
    .Returns(1);

See Also