IsInRange(TValue) Method

Moq

Collapse image Expand Image Copy image CopyHover image
Matches any value that is in the range specified.

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

Syntax

C#
public static Expression IsInRange<TValue>(
	TValue from,
	TValue to,
	Range rangeKind
)
where TValue : IComparable

Parameters

from
Type: TValue
The lower bound of the range.
to
Type: TValue
The upper bound of the range.
rangeKind
Type: Moq..::..Range
The kind of range. See Range.

Type Parameters

TValue
Type of the argument to check.

Examples

The following example shows how to expect a method call with an integer argument within the 0..100 range.
CopyC#
mock.Protected()
    .Setup("HasInventory",
            ItExpr.IsAny<string>(),
            ItExpr.IsInRange(0, 100, Range.Inclusive))
    .Returns(false);

See Also