Class
Arg

Allows specification of a matching condition for an argument, rather a specific value.

Definition

Namespace:Telerik.JustMock

Assembly:Telerik.JustMock.dll

Syntax:

cs-api-definition
public static class Arg

Inheritance: objectArg

Properties

AnyBool

Gets a value indicating that argument can contain any bool value.

Declaration

cs-api-definition
public static bool AnyBool { get; }

Property Value

bool

AnyByte

Gets a value indicating that argument can contain any byte value.

Declaration

cs-api-definition
public static byte AnyByte { get; }

Property Value

byte

AnyChar

Gets a value indicating that argument can contain any char value.

Declaration

cs-api-definition
public static char AnyChar { get; }

Property Value

char

AnyDateTime

Gets a value indicating that argument can contain any DateTime value.

Declaration

cs-api-definition
public static DateTime AnyDateTime { get; }

Property Value

DateTime

AnyDecimal

Gets a value indicating that argument can contain any decimal value.

Declaration

cs-api-definition
public static decimal AnyDecimal { get; }

Property Value

decimal

AnyDouble

Gets a value indicating that argument can contain any double value.

Declaration

cs-api-definition
public static double AnyDouble { get; }

Property Value

double

AnyFloat

Gets a value indicating that argument can contain any float value.

Declaration

cs-api-definition
public static float AnyFloat { get; }

Property Value

float

AnyGuid

Gets a value indicating that argument can contain any Guid value.

Declaration

cs-api-definition
public static Guid AnyGuid { get; }

Property Value

Guid

AnyInt

Gets a value indicating that argument can contain any int value.

Declaration

cs-api-definition
public static int AnyInt { get; }

Property Value

int

AnyLong

Gets a value indicating that argument can contain any long value.

Declaration

cs-api-definition
public static long AnyLong { get; }

Property Value

long

AnyObject

Gets a value indicating that argument can contain any object value.

Declaration

cs-api-definition
public static object AnyObject { get; }

Property Value

object

AnySByte

Gets a value indicating that argument can contain any SByte value.

Declaration

cs-api-definition
public static sbyte AnySByte { get; }

Property Value

sbyte

AnyShort

Gets a value indicating that argument can contain any short value.

Declaration

cs-api-definition
public static short AnyShort { get; }

Property Value

short

AnyString

Gets a value indicating that argument can contain any string value.

Declaration

cs-api-definition
public static string AnyString { get; }

Property Value

string

AnyTimeSpan

Gets a value indicating that argument can contain any TimeSpan value.

Declaration

cs-api-definition
public static TimeSpan AnyTimeSpan { get; }

Property Value

TimeSpan

AnyUri

Gets a value indicating that argument can contain any Uri value.

Declaration

cs-api-definition
public static Uri AnyUri { get; }

Property Value

Uri

Expr

Specifies argument matchers used in non-public method arrangements.

Declaration

cs-api-definition
public static IArgExpr Expr { get; }

Property Value

IArgExpr

NullOrEmpty

Matches argument for null or empty value.

Declaration

cs-api-definition
public static string NullOrEmpty { get; }

Property Value

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

cs-api-definition
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

cs-api-definition
public static T IsAny<T>()

Returns

T

Argument type

IsInRange<T>(T, T, RangeKind)

Matches argument for the specified range.

Declaration

cs-api-definition
public static T IsInRange<T>(T from, T to, RangeKind kind) where T : IComparable

Parameters

from

T

starting value.

to

T

ending value.

kind

RangeKind

Kind of Range

Returns

T

Argument type

IsNull<T>()

Matches argument for null value.

Declaration

cs-api-definition
public static T IsNull<T>()

Returns

T

Argument type

Matches<T>(Expression<Predicate<T>>)

Matches argument for the expected condition.

Declaration

cs-api-definition
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

cs-api-definition
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.