IsRegex Method (String)

Moq

Collapse image Expand Image Copy image CopyHover image
Matches a string argument if it matches the given regular expression pattern.

Namespace: Moq
Assembly: Moq (in Moq.dll) Version: 4.0.10827.0 (4.0.0.0)

Syntax

C#
public static string IsRegex(
	string regex
)

Parameters

regex
Type: System..::..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.Setup(x => x.Check(It.IsRegex("[a-z]+"))).Returns(1);

See Also