ClassArg
Allows specification of a matching condition for an argument, rather a specific value.
Definition
Namespace:Telerik.JustMock
Assembly:Telerik.JustMock.dll
Syntax:
public static class Arg
Inheritance: objectArg
Properties
AnyBool
Gets a value indicating that argument can contain any bool value.
AnyByte
Gets a value indicating that argument can contain any byte value.
AnyChar
Gets a value indicating that argument can contain any char value.
AnyDateTime
Gets a value indicating that argument can contain any DateTime value.
AnyDecimal
Gets a value indicating that argument can contain any decimal value.
AnyDouble
Gets a value indicating that argument can contain any double value.
AnyFloat
Gets a value indicating that argument can contain any float value.
AnyGuid
Gets a value indicating that argument can contain any Guid value.
AnyInt
Gets a value indicating that argument can contain any int value.
AnyLong
Gets a value indicating that argument can contain any long value.
AnyObject
Gets a value indicating that argument can contain any object value.
AnySByte
Gets a value indicating that argument can contain any SByte value.
AnyShort
Gets a value indicating that argument can contain any short value.
AnyString
Gets a value indicating that argument can contain any string value.
AnyTimeSpan
Gets a value indicating that argument can contain any TimeSpan value.
AnyUri
Gets a value indicating that argument can contain any Uri value.
Declaration
public static Uri AnyUri { get; }
Property Value
Uri
Expr
Specifies argument matchers used in non-public method arrangements.
NullOrEmpty
Matches argument for null or empty value.
Methods
Is<T>(T)
Matches the specified value. Useful for mingling concrete values and more general matchers in the same expression when using delegate-based overloads.
Declaration
public static T Is<T>(T value)
Parameters
value
T
Value to match
Returns
T
Argument type
IsAny<T>()
Matches argument for any value.
Declaration
public static T IsAny<T>()
Returns
T
Argument type
IsInRange<T>(T, T, RangeKind)
Matches argument for the specified range.
Declaration
public static T IsInRange<T>(T from, T to, RangeKind kind) where T : IComparable
Parameters
from
T
starting value.
to
T
ending value.
kind
Kind of Range
Returns
T
Argument type
IsNull<T>()
Matches argument for null value.
Declaration
public static T IsNull<T>()
Returns
T
Argument type
Matches<T>(Expression<Predicate<T>>)
Matches argument for the expected condition.
Declaration
public static T Matches<T>(Expression<Predicate<T>> match)
Parameters
match
Expression<Predicate<T>>
Matcher expression
Returns
T
Argument type
Ref<T>(T)
Applies a matcher to a 'ref' parameter.
By default, 'ref' parameters work like implicitly arranged return values. In other words, you arrange a method to return a given value through its 'ref' and 'out' parameters. Use this method to specify that the argument should have a matcher applied just like regular arguments.
Declaration
public static Arg.OutRefResult<T> Ref<T>(T value)
Parameters
value
T
A matcher or a value.
Returns
Arg.OutRefResult<T>
A special value with member 'Value' that must be passed by ref.
Example
interface IHasRef { int PassRef(ref int a); }
var mock = Mock.Create<IHasRef>() Mock.Arrange(() => mock.PassRef(ref Arg.Ref(100).Value).Returns(200);
The above example arranges PassRef to return 200 whenever its argument is 100.