IsInRange(TValue) Method

Moq 2.6

Matches any value that is in the range specified.

Namespace:  Moq.Protected
Assembly:  Moq (in Moq.dll) Version: 2.6.1014.1 (2.6.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()
    .Expect("HasInventory",
            ItExpr.IsAny<string>(),
            ItExpr.IsInRange(0, 100, Range.Inclusive))
    .Returns(false);

See Also