justmock-docs/api/m_telerik_justmock_arg_ref_...

2.7 KiB

title page_title description previous_url slug published fullPath category
Ref(T) Method Ref(T) Method | JustMock Documentation Documentation page about Ref(T) Method . /m_telerik_justmock_arg_ref__1.html m_telerik_justmock_arg_ref__1 True api/n_telerik_justmock/t_telerik_justmock_arg/methods_t_telerik_justmock_arg/m_telerik_justmock_arg_ref__1 api

Arg.Ref<T>Method

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.

Namespace: Telerik.JustMock
Assembly: Telerik.JustMock(in Telerik.JustMock.dll)

Syntax

C#
public static Arg..::..OutRefResult<T> Ref<T>(
	T value
)
Visual Basic
Public Shared Function Ref(Of T) ( _
	value As T _
) As Arg..::..OutRefResult(Of T)

value

Type:T
A matcher or a value.

Type Parameters

T

Type for the argument

A special value with member 'Value' that must be passed by ref.

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.

See Also

Arg Class

Arg Members

Telerik.JustMock Namespace