skip navigation
  • Product Bundles

    DevCraft

    All Telerik .NET tools and Kendo UI JavaScript components in one package. Now enhanced with:

    • AI Coding Assistants
    • Embedded Reporting
    • Document Processing Libraries
    • SSO Account Sign-in

    Web

    Kendo UI UI for Angular UI for Vue UI for jQuery KendoReact UI for Blazor UI for ASP.NET Core UI for ASP.NET MVC UI for ASP.NET AJAX

    Mobile

    UI for .NET MAUI

    Document Management

    Telerik Document Processing

    Desktop

    UI for .NET MAUI UI for WinUI UI for WinForms UI for WPF

    Reporting

    Telerik Reporting Telerik Report Server

    Testing & Mocking

    Test Studio Telerik JustMock

    CMS

    Sitefinity

    AI Productivity Tools

    AI Coding Assistants

    UI/UX Tools

    ThemeBuilder Design System Kit Templates and Building Blocks

    Debugging

    Fiddler Fiddler Everywhere Fiddler Classic Fiddler Everywhere Reporter FiddlerCore

    Free Tools

    KendoReact Free VB.NET to C# Converter Testing Framework
    View all products
  • Overview
    • What's New
    • Roadmap
    • Release History
  • Docs & Support
  • Pricing
  • Shopping cart
    • Account Overview
    • Your Licenses
    • Downloads
    • Support Center
    • Forum Profile
    • Payment Methods
    • Edit Profile
    • Log out
  • Login
  • Contact Us
  • Try now

Class Arg

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

Inheritance
System.Object
Arg
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
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.

Getting Started
  • Unit Testing and Mocking Explained
  • Videos
  • FAQs
Community
  • Forums
  • Blogs
  • Feedback Portal

Copyright © 2019 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.

Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.