Class Arg
Allows specification of a matching condition for an argument, rather a specific value.
Inheritance
Inherited Members
Namespace: Telerik.JustMock
Assembly: Telerik.JustMock.dll
Syntax
public static class Arg
Properties
AnyBool
Gets a value indicating that argument can contain any bool value.
Declaration
public static bool AnyBool { get; }
Property Value
System.Boolean
|
AnyByte
Gets a value indicating that argument can contain any byte value.
Declaration
public static byte AnyByte { get; }
Property Value
System.Byte
|
AnyChar
Gets a value indicating that argument can contain any char value.
Declaration
public static char AnyChar { get; }
Property Value
System.Char
|
AnyDateTime
Gets a value indicating that argument can contain any DateTime value.
Declaration
public static DateTime AnyDateTime { get; }
Property Value
System.DateTime
|
AnyDecimal
Gets a value indicating that argument can contain any decimal value.
Declaration
public static decimal AnyDecimal { get; }
Property Value
System.Decimal
|
AnyDouble
Gets a value indicating that argument can contain any double value.
Declaration
public static double AnyDouble { get; }
Property Value
System.Double
|
AnyFloat
Gets a value indicating that argument can contain any float value.
Declaration
public static float AnyFloat { get; }
Property Value
System.Single
|
AnyGuid
Gets a value indicating that argument can contain any Guid value.
Declaration
public static Guid AnyGuid { get; }
Property Value
System.Guid
|
AnyInt
Gets a value indicating that argument can contain any int value.
Declaration
public static int AnyInt { get; }
Property Value
System.Int32
|
AnyLong
Gets a value indicating that argument can contain any long value.
Declaration
public static long AnyLong { get; }
Property Value
System.Int64
|
AnyObject
Gets a value indicating that argument can contain any object value.
Declaration
public static object AnyObject { get; }
Property Value
System.Object
|
AnySByte
Gets a value indicating that argument can contain any SByte value.
Declaration
public static sbyte AnySByte { get; }
Property Value
System.SByte
|
AnyShort
Gets a value indicating that argument can contain any short value.
Declaration
public static short AnyShort { get; }
Property Value
System.Int16
|
AnyString
Gets a value indicating that argument can contain any string value.
Declaration
public static string AnyString { get; }
Property Value
System.String
|
AnyTimeSpan
Gets a value indicating that argument can contain any TimeSpan value.
Declaration
public static TimeSpan AnyTimeSpan { get; }
Property Value
System.TimeSpan
|
AnyUri
Gets a value indicating that argument can contain any Uri value.
Declaration
public static Uri AnyUri { get; }
Property Value
System.Uri
|
Expr
Specifies argument matchers used in non-public method arrangements.
Declaration
public static IArgExpr Expr { get; }
Property Value
IArgExpr
|
NullOrEmpty
Matches argument for null or empty value.
Declaration
public static string NullOrEmpty { get; }
Property Value
System.String
Null |
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
T
value
Value to match |
Returns
T
Argument type |
Type Parameters
T
Type for the argument |
IsAny<T>()
Matches argument for any value.
Declaration
public static T IsAny<T>()
Returns
T
Argument type |
Type Parameters
T
Type for the argument |
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
T
from
starting value. |
T
to
ending value. |
RangeKind
kind
Kind of Range |
Returns
T
Argument type |
Type Parameters
T
Type of the argument. |
IsNull<T>()
Matches argument for null value.
Declaration
public static T IsNull<T>()
Returns
T
Argument type |
Type Parameters
T
Type for the argument |
Matches<T>(Expression<Predicate<T>>)
Matches argument for the expected condition.
Declaration
public static T Matches<T>(Expression<Predicate<T>> match)
Parameters
System.Linq.Expressions.Expression<System.Predicate<T>>
match
Matcher expression |
Returns
T
Argument type |
Type Parameters
T
Contains the type of the argument. |
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
T
value
A matcher or a value. |
Returns
Arg.OutRefResult<T>
A special value with member 'Value' that must be passed by ref. |
Type Parameters
T
Type for the argument |
Examples
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.