Class
CommonExpectation<TContainer>

Implements common expectations.

Definition

Namespace:Telerik.JustMock.Expectations

Assembly:Telerik.JustMock.dll

Type Parameters:

TContainer

Syntax:

cs-api-definition
public class CommonExpectation<TContainer> : IAction<TContainer>, IDoInstead<TContainer>, IThrows<TContainer>, IAssertable, IMustBeCalled, ISetupBehavior, IOccurrence, IOrder, IPrerequisite, IDisposable, IInstanceScope<TContainer>

Inheritance: objectCommonExpectation<TContainer>

Derived Classes: ActionExpectationCollectionExpectation<TReturn>

Implements: IAction<TContainer>IAssertableIDisposableIDoInstead<TContainer>IInstanceScope<TContainer>IMustBeCalledIOccurrenceIOrderIPrerequisiteISetupBehaviorIThrows<TContainer>

Properties

IsMet

Determines whether prerequisite is met

Declaration

cs-api-definition
public bool IsMet { get; }

Property Value

bool

Implements IPrerequisite.IsMet

Methods

AfterAll(params IPrerequisite[])

Specifies that a call should occur only after all of the given prerequisites have been met.

Declaration

cs-api-definition
public IAssertable AfterAll(params IPrerequisite[] prerequisites)

Parameters

prerequisites

IPrerequisite[]

Returns

IAssertable

Implements IPrerequisite.AfterAll(params IPrerequisite[])

CallOriginal()

Calls the original implementation when the arranged call occurs.

Declaration

cs-api-definition
public IAssertable CallOriginal()

Returns

IAssertable

The current expectation so that you can continue the arrangement.

Implements IAssertable.CallOriginal()

Dispose()

Removes this arrangement. Its side effects will no longer be executed and its expectations will not be asserted.

Declaration

cs-api-definition
public void Dispose()

Implements IDisposable.Dispose()

DoInstead(Action)

Runs the supplied delegate instead of the arranged member body.

Declaration

cs-api-definition
public TContainer DoInstead(Action action)

Parameters

action

Action

Delegate to run when the arranged call occurs.

Returns

TContainer

The current expectation so that you can continue the arrangement.

Implements IDoInstead<TContainer>.DoInstead(Action)

DoInstead(Delegate)

Runs the supplied delegate instead of the arranged member body.

Declaration

cs-api-definition
public TContainer DoInstead(Delegate @delegate)

Parameters

delegate

Delegate

Delegate to run when the arranged call occurs.

Returns

TContainer

The current expectation so that you can continue the arrangement.

Implements IDoInstead<TContainer>.DoInstead(Delegate)

DoInstead<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>)

Specifies the delegate that will execute for the expected method.

Declaration

cs-api-definition
public TContainer DoInstead<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> action)

Parameters

action

Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>

Target action delegate to execute as method body

Returns

TContainer

Implements IDoInstead<TContainer>.DoInstead<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>)

DoInstead<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>)

Specifies the delegate that will execute for the expected method.

Declaration

cs-api-definition
public TContainer DoInstead<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> action)

Parameters

action

Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>

Target action delegate to execute as method body

Returns

TContainer

Implements IDoInstead<TContainer>.DoInstead<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>)

DoInstead<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>)

Specifies the delegate that will execute for the expected method.

Declaration

cs-api-definition
public TContainer DoInstead<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> action)

Parameters

action

Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>

Target action delegate to execute as method body

Returns

TContainer

Implements IDoInstead<TContainer>.DoInstead<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>)

DoInstead<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>)

Specifies the delegate that will execute for the expected method.

Declaration

cs-api-definition
public TContainer DoInstead<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> action)

Parameters

action

Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>

Target action delegate to execute as method body

Returns

TContainer

Implements IDoInstead<TContainer>.DoInstead<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>)

DoInstead<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>)

Specifies the delegate that will execute for the expected method.

Declaration

cs-api-definition
public TContainer DoInstead<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> action)

Parameters

action

Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>

Target action delegate to execute as method body

Returns

TContainer

Implements IDoInstead<TContainer>.DoInstead<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>)

DoInstead<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>)

Specifies the delegate that will execute for the expected method.

Declaration

cs-api-definition
public TContainer DoInstead<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> action)

Parameters

action

Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>

Target action delegate to execute as method body

Returns

TContainer

Implements IDoInstead<TContainer>.DoInstead<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>)

DoInstead<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>)

Specifies the delegate that will execute for the expected method.

Declaration

cs-api-definition
public TContainer DoInstead<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> action)

Parameters

action

Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>

Target action delegate to execute as method body

Returns

TContainer

Implements IDoInstead<TContainer>.DoInstead<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>)

DoInstead<T1, T2, T3, T4, T5, T6, T7, T8, T9>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9>)

Specifies the delegate that will execute for the expected method.

Declaration

cs-api-definition
public TContainer DoInstead<T1, T2, T3, T4, T5, T6, T7, T8, T9>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9> action)

Parameters

action

Action<T1, T2, T3, T4, T5, T6, T7, T8, T9>

Target action delegate to execute as method body

Returns

TContainer

Implements IDoInstead<TContainer>.DoInstead<T1, T2, T3, T4, T5, T6, T7, T8, T9>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9>)

DoInstead<T1, T2, T3, T4, T5, T6, T7, T8>(Action<T1, T2, T3, T4, T5, T6, T7, T8>)

Specifies the delegate that will execute for the expected method.

Declaration

cs-api-definition
public TContainer DoInstead<T1, T2, T3, T4, T5, T6, T7, T8>(Action<T1, T2, T3, T4, T5, T6, T7, T8> action)

Parameters

action

Action<T1, T2, T3, T4, T5, T6, T7, T8>

Target action delegate to execute as method body

Returns

TContainer

Implements IDoInstead<TContainer>.DoInstead<T1, T2, T3, T4, T5, T6, T7, T8>(Action<T1, T2, T3, T4, T5, T6, T7, T8>)

DoInstead<T1, T2, T3, T4, T5, T6, T7>(Action<T1, T2, T3, T4, T5, T6, T7>)

Specifies the delegate that will execute for the expected method.

Declaration

cs-api-definition
public TContainer DoInstead<T1, T2, T3, T4, T5, T6, T7>(Action<T1, T2, T3, T4, T5, T6, T7> action)

Parameters

action

Action<T1, T2, T3, T4, T5, T6, T7>

Target action delegate to execute as method body

Returns

TContainer

Implements IDoInstead<TContainer>.DoInstead<T1, T2, T3, T4, T5, T6, T7>(Action<T1, T2, T3, T4, T5, T6, T7>)

DoInstead<T1, T2, T3, T4, T5, T6>(Action<T1, T2, T3, T4, T5, T6>)

Specifies the delegate that will execute for the expected method.

Declaration

cs-api-definition
public TContainer DoInstead<T1, T2, T3, T4, T5, T6>(Action<T1, T2, T3, T4, T5, T6> action)

Parameters

action

Action<T1, T2, T3, T4, T5, T6>

Target action delegate to execute as method body

Returns

TContainer

Implements IDoInstead<TContainer>.DoInstead<T1, T2, T3, T4, T5, T6>(Action<T1, T2, T3, T4, T5, T6>)

DoInstead<T1, T2, T3, T4, T5>(Action<T1, T2, T3, T4, T5>)

Specifies the delegate that will execute for the expected method.

Declaration

cs-api-definition
public TContainer DoInstead<T1, T2, T3, T4, T5>(Action<T1, T2, T3, T4, T5> action)

Parameters

action

Action<T1, T2, T3, T4, T5>

Target action delegate to execute as method body

Returns

TContainer

Implements IDoInstead<TContainer>.DoInstead<T1, T2, T3, T4, T5>(Action<T1, T2, T3, T4, T5>)

DoInstead<T1, T2, T3, T4>(Action<T1, T2, T3, T4>)

Specifies the delegate that will execute for the expected method.

Declaration

cs-api-definition
public TContainer DoInstead<T1, T2, T3, T4>(Action<T1, T2, T3, T4> action)

Parameters

action

Action<T1, T2, T3, T4>

Target action delegate to execute as method body

Returns

TContainer

Implements IDoInstead<TContainer>.DoInstead<T1, T2, T3, T4>(Action<T1, T2, T3, T4>)

DoInstead<T1, T2, T3>(Action<T1, T2, T3>)

Specifies the delegate that will execute for the expected method.

Declaration

cs-api-definition
public TContainer DoInstead<T1, T2, T3>(Action<T1, T2, T3> action)

Parameters

action

Action<T1, T2, T3>

Target action delegate to execute as method body

Returns

TContainer

Implements IDoInstead<TContainer>.DoInstead<T1, T2, T3>(Action<T1, T2, T3>)

DoInstead<T1, T2>(Action<T1, T2>)

Specifies the delegate that will execute for the expected method.

Declaration

cs-api-definition
public TContainer DoInstead<T1, T2>(Action<T1, T2> action)

Parameters

action

Action<T1, T2>

Target action delegate to execute as method body

Returns

TContainer

Implements IDoInstead<TContainer>.DoInstead<T1, T2>(Action<T1, T2>)

DoInstead<T1>(Action<T1>)

Specifies the delegate that will execute for the expected method.

Declaration

cs-api-definition
public TContainer DoInstead<T1>(Action<T1> action)

Parameters

action

Action<T1>

Target action delegate to execute as method body

Returns

TContainer

Implements IDoInstead<TContainer>.DoInstead<T1>(Action<T1>)

DoNothing()

Leaves the arranged void call without additional behavior.

Declaration

cs-api-definition
public IAssertable DoNothing()

Returns

IAssertable

The current expectation so that you can continue the arrangement.

Implements IAction<TContainer>.DoNothing()

Remarks

Use this method when you want the call to succeed without throwing or running custom logic. Loose mocks already behave this way by default.

IgnoreArguments()

Specifies to ignore any argument for the target call.

Declaration

cs-api-definition
public TContainer IgnoreArguments()

Returns

TContainer

Func or Action Container

IgnoreInstance()

Defines that the expectation should occur for all instance.

Declaration

cs-api-definition
public TContainer IgnoreInstance()

Returns

TContainer

Implements IInstanceScope<TContainer>.IgnoreInstance()

InOrder(string)

Specifies a call should occur in a specific order.

Declaration

cs-api-definition
public IOccurrence InOrder(string message = null)

Parameters

message

string

Returns

IOccurrence

Implements IOrder.InOrder(string)

InSequence()

Specifies that JustMock should invoke different mock instance for each setup.

Declaration

cs-api-definition
public IAssertable InSequence()

Returns

IAssertable

Implements ISetupBehavior.InSequence()

Remarks

When this modifier is applied for similar type call, the flow of setups will be maintained.

MustBeCalled(string)

Specifies that the arranged member must be called. Asserting the mock will throw if the expectation is not fulfilled.

Declaration

cs-api-definition
public IDisposable MustBeCalled(string message = null)

Parameters

message

string

Returns

IDisposable

Implements IMustBeCalled.MustBeCalled(string)

Occurs(int, string)

Specifies how many times the call should occur.

Declaration

cs-api-definition
public IDisposable Occurs(int numberOfTimes, string message = null)

Parameters

numberOfTimes

int

Specified number of times

message

string

Returns

IDisposable

Implements IOccurrence.Occurs(int, string)

OccursAtLeast(int, string)

Specifies how many times atleast the call should occur.

Declaration

cs-api-definition
public IDisposable OccursAtLeast(int numberOfTimes, string message = null)

Parameters

numberOfTimes

int

Specified number of times

message

string

Returns

IDisposable

Implements IOccurrence.OccursAtLeast(int, string)

OccursAtMost(int, string)

Specifies how many times maximum the call can occur.

Declaration

cs-api-definition
public IDisposable OccursAtMost(int numberOfTimes, string message = null)

Parameters

numberOfTimes

int

Specified number of times

message

string

Returns

IDisposable

Implements IOccurrence.OccursAtMost(int, string)

OccursNever(string)

Specifies that the call must never occur.

Declaration

cs-api-definition
public IDisposable OccursNever(string message = null)

Parameters

message

string

Returns

IDisposable

Implements IOccurrence.OccursNever(string)

OccursOnce(string)

Specifies that the call must occur once.

Declaration

cs-api-definition
public IDisposable OccursOnce(string message = null)

Parameters

message

string

Returns

IDisposable

Implements IOccurrence.OccursOnce(string)

OnAllThreads()

Specifies that the arrangement will be respected regardless of the thread on which the call to the arranged member happens.

Declaration

cs-api-definition
public IAssertable OnAllThreads()

Returns

IAssertable

Implements ISetupBehavior.OnAllThreads()

Remarks

This is only needed for arrangements of static members. Arrangements on instance members are always respected, regardless of the current thread.

Cross-thread arrangements are active as long as the current context (test method) is on the call stack. Be careful when arranging static members cross-thread because the effects of the arrangement may affect and even crash the testing framework.

ProcessDoInstead(Delegate, bool)

Implementation detail.

Declaration

cs-api-definition
protected void ProcessDoInstead(Delegate delg, bool ignoreDelegateReturnValue)

Parameters

delg

Delegate

ignoreDelegateReturnValue

bool

Raises(Action, EventArgs)

Raises the specified event when the arranged call occurs.

Declaration

cs-api-definition
public TContainer Raises(Action eventExpression, EventArgs args)

Parameters

eventExpression

Action

Expression that identifies the event to raise.

args

EventArgs

Event arguments to pass to the handler.

Returns

TContainer

The current expectation so that you can continue the arrangement.

Exceptions

InvalidOperationException

Thrown when JustMock cannot resolve the event expression.

Implements IAction<TContainer>.Raises(Action, EventArgs)

Raises(Action, params object[])

Raises the specified event when the arranged call occurs.

Declaration

cs-api-definition
public TContainer Raises(Action eventExpression, params object[] args)

Parameters

eventExpression

Action

Expression that identifies the event to raise.

args

object[]

Arguments to pass to the event handler delegate.

Returns

TContainer

The current expectation so that you can continue the arrangement.

Implements IAction<TContainer>.Raises(Action, params object[])

Raises<T1, T2, T3, T4>(Action, Func<T1, T2, T3, T4, EventArgs>)

Raises the specified event when the arranged call occurs.

Declaration

cs-api-definition
public TContainer Raises<T1, T2, T3, T4>(Action eventExpression, Func<T1, T2, T3, T4, EventArgs> func)

Parameters

eventExpression

Action

Expression that identifies the event to raise.

func

Func<T1, T2, T3, T4, EventArgs>

Function that creates the event arguments from the arranged call arguments.

Returns

TContainer

The current expectation so that you can continue the arrangement.

Exceptions

InvalidOperationException

Thrown when JustMock cannot resolve the event expression.

Implements IAction<TContainer>.Raises<T1, T2, T3, T4>(Action, Func<T1, T2, T3, T4, EventArgs>)

Raises<T1, T2, T3>(Action, Func<T1, T2, T3, EventArgs>)

Raises the specified event when the arranged call occurs.

Declaration

cs-api-definition
public TContainer Raises<T1, T2, T3>(Action eventExpression, Func<T1, T2, T3, EventArgs> func)

Parameters

eventExpression

Action

Expression that identifies the event to raise.

func

Func<T1, T2, T3, EventArgs>

Function that creates the event arguments from the arranged call arguments.

Returns

TContainer

The current expectation so that you can continue the arrangement.

Exceptions

InvalidOperationException

Thrown when JustMock cannot resolve the event expression.

Implements IAction<TContainer>.Raises<T1, T2, T3>(Action, Func<T1, T2, T3, EventArgs>)

Raises<T1, T2>(Action, Func<T1, T2, EventArgs>)

Raises the specified event when the arranged call occurs.

Declaration

cs-api-definition
public TContainer Raises<T1, T2>(Action eventExpression, Func<T1, T2, EventArgs> func)

Parameters

eventExpression

Action

Expression that identifies the event to raise.

func

Func<T1, T2, EventArgs>

Function that creates the event arguments from the arranged call arguments.

Returns

TContainer

The current expectation so that you can continue the arrangement.

Exceptions

InvalidOperationException

Thrown when JustMock cannot resolve the event expression.

Implements IAction<TContainer>.Raises<T1, T2>(Action, Func<T1, T2, EventArgs>)

Raises<T1>(Action, Func<T1, EventArgs>)

Raises the specified event when the arranged call occurs.

Declaration

cs-api-definition
public TContainer Raises<T1>(Action eventExpression, Func<T1, EventArgs> func)

Parameters

eventExpression

Action

Expression that identifies the event to raise.

func

Func<T1, EventArgs>

Function that creates the event arguments from the arranged call arguments.

Returns

TContainer

The current expectation so that you can continue the arrangement.

Exceptions

InvalidOperationException

Thrown when JustMock cannot resolve the event expression.

Implements IAction<TContainer>.Raises<T1>(Action, Func<T1, EventArgs>)

Throws(Exception)

Throws the specified exception when the arranged call occurs.

Declaration

cs-api-definition
public IAssertable Throws(Exception exception)

Parameters

exception

Exception

Exception instance to throw.

Returns

IAssertable

The current expectation so that you can continue the arrangement.

Implements IThrows<TContainer>.Throws(Exception)

Throws<T>()

Throws a new exception of the specified type when the arranged call occurs.

Declaration

cs-api-definition
public IAssertable Throws<T>() where T : Exception

Returns

IAssertable

The current expectation so that you can continue the arrangement.

Implements IThrows<TContainer>.Throws<T>()

Throws<T>(params object[])

Throws a new exception of the specified type when the arranged call occurs.

Declaration

cs-api-definition
public IAssertable Throws<T>(params object[] args) where T : Exception

Parameters

args

object[]

Arguments to pass to the exception constructor.

Returns

IAssertable

The current expectation so that you can continue the arrangement.

Implements IThrows<TContainer>.Throws<T>(params object[])

ThrowsAsync(Exception)

Faults the returned task with the specified exception when the arranged async call occurs.

Declaration

cs-api-definition
public IAssertable ThrowsAsync(Exception exception)

Parameters

exception

Exception

Exception instance to use for the faulted task.

Returns

IAssertable

The current expectation so that you can continue the arrangement.

Implements IThrows<TContainer>.ThrowsAsync(Exception)

ThrowsAsync<T>()

Faults the returned task with a new exception of the specified type when the arranged async call occurs.

Declaration

cs-api-definition
public IAssertable ThrowsAsync<T>() where T : Exception

Returns

IAssertable

The current expectation so that you can continue the arrangement.

Implements IThrows<TContainer>.ThrowsAsync<T>()

ThrowsAsync<T>(params object[])

Faults the returned task with a new exception of the specified type when the arranged async call occurs.

Declaration

cs-api-definition
public IAssertable ThrowsAsync<T>(params object[] args) where T : Exception

Parameters

args

object[]

Arguments to pass to the exception constructor.

Returns

IAssertable

The current expectation so that you can continue the arrangement.

Implements IThrows<TContainer>.ThrowsAsync<T>(params object[])

When(Func<bool>)

Specifies an additional condition that must be true for this arrangement to be considered when the arranged member is called. This condition is evaluated in addition to the conditions imposed by any argument matchers in the arrangement.

This method allows a more general way of matching arrangements than argument matchers do.

Declaration

cs-api-definition
public TContainer When(Func<bool> condition)

Parameters

condition

Func<bool>

A function that should return 'true' when this arrangement should be considered and 'false' if this arrangement doesn't match the user criteria.

Returns

TContainer

When<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, bool>)

Specifies an additional condition that must be true for this arrangement to be considered when the arranged member is called. This condition is evaluated in addition to the conditions imposed by any argument matchers in the arrangement.

This method allows a more general way of matching arrangements than argument matchers do.

Declaration

cs-api-definition
public TContainer When<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, bool> condition)

Parameters

condition

Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, bool>

A function that should return 'true' when this arrangement should be considered and 'false' if this arrangement doesn't match the user criteria.

Returns

TContainer

When<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, bool>)

Specifies an additional condition that must be true for this arrangement to be considered when the arranged member is called. This condition is evaluated in addition to the conditions imposed by any argument matchers in the arrangement.

This method allows a more general way of matching arrangements than argument matchers do.

Declaration

cs-api-definition
public TContainer When<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, bool> condition)

Parameters

condition

Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, bool>

A function that should return 'true' when this arrangement should be considered and 'false' if this arrangement doesn't match the user criteria.

Returns

TContainer

When<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, bool>)

Specifies an additional condition that must be true for this arrangement to be considered when the arranged member is called. This condition is evaluated in addition to the conditions imposed by any argument matchers in the arrangement.

This method allows a more general way of matching arrangements than argument matchers do.

Declaration

cs-api-definition
public TContainer When<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, bool> condition)

Parameters

condition

Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, bool>

A function that should return 'true' when this arrangement should be considered and 'false' if this arrangement doesn't match the user criteria.

Returns

TContainer

When<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, bool>)

Specifies an additional condition that must be true for this arrangement to be considered when the arranged member is called. This condition is evaluated in addition to the conditions imposed by any argument matchers in the arrangement.

This method allows a more general way of matching arrangements than argument matchers do.

Declaration

cs-api-definition
public TContainer When<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, bool> condition)

Parameters

condition

Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, bool>

A function that should return 'true' when this arrangement should be considered and 'false' if this arrangement doesn't match the user criteria.

Returns

TContainer

When<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, bool>)

Specifies an additional condition that must be true for this arrangement to be considered when the arranged member is called. This condition is evaluated in addition to the conditions imposed by any argument matchers in the arrangement.

This method allows a more general way of matching arrangements than argument matchers do.

Declaration

cs-api-definition
public TContainer When<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, bool> condition)

Parameters

condition

Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, bool>

A function that should return 'true' when this arrangement should be considered and 'false' if this arrangement doesn't match the user criteria.

Returns

TContainer

When<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, bool>)

Specifies an additional condition that must be true for this arrangement to be considered when the arranged member is called. This condition is evaluated in addition to the conditions imposed by any argument matchers in the arrangement.

This method allows a more general way of matching arrangements than argument matchers do.

Declaration

cs-api-definition
public TContainer When<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, bool> condition)

Parameters

condition

Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, bool>

A function that should return 'true' when this arrangement should be considered and 'false' if this arrangement doesn't match the user criteria.

Returns

TContainer

When<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, bool>)

Specifies an additional condition that must be true for this arrangement to be considered when the arranged member is called. This condition is evaluated in addition to the conditions imposed by any argument matchers in the arrangement.

This method allows a more general way of matching arrangements than argument matchers do.

Declaration

cs-api-definition
public TContainer When<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, bool> condition)

Parameters

condition

Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, bool>

A function that should return 'true' when this arrangement should be considered and 'false' if this arrangement doesn't match the user criteria.

Returns

TContainer

When<T1, T2, T3, T4, T5, T6, T7, T8, T9>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, bool>)

Specifies an additional condition that must be true for this arrangement to be considered when the arranged member is called. This condition is evaluated in addition to the conditions imposed by any argument matchers in the arrangement.

This method allows a more general way of matching arrangements than argument matchers do.

Declaration

cs-api-definition
public TContainer When<T1, T2, T3, T4, T5, T6, T7, T8, T9>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, bool> condition)

Parameters

condition

Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, bool>

A function that should return 'true' when this arrangement should be considered and 'false' if this arrangement doesn't match the user criteria.

Returns

TContainer

When<T1, T2, T3, T4, T5, T6, T7, T8>(Func<T1, T2, T3, T4, T5, T6, T7, T8, bool>)

Specifies an additional condition that must be true for this arrangement to be considered when the arranged member is called. This condition is evaluated in addition to the conditions imposed by any argument matchers in the arrangement.

This method allows a more general way of matching arrangements than argument matchers do.

Declaration

cs-api-definition
public TContainer When<T1, T2, T3, T4, T5, T6, T7, T8>(Func<T1, T2, T3, T4, T5, T6, T7, T8, bool> condition)

Parameters

condition

Func<T1, T2, T3, T4, T5, T6, T7, T8, bool>

A function that should return 'true' when this arrangement should be considered and 'false' if this arrangement doesn't match the user criteria.

Returns

TContainer

When<T1, T2, T3, T4, T5, T6, T7>(Func<T1, T2, T3, T4, T5, T6, T7, bool>)

Specifies an additional condition that must be true for this arrangement to be considered when the arranged member is called. This condition is evaluated in addition to the conditions imposed by any argument matchers in the arrangement.

This method allows a more general way of matching arrangements than argument matchers do.

Declaration

cs-api-definition
public TContainer When<T1, T2, T3, T4, T5, T6, T7>(Func<T1, T2, T3, T4, T5, T6, T7, bool> condition)

Parameters

condition

Func<T1, T2, T3, T4, T5, T6, T7, bool>

A function that should return 'true' when this arrangement should be considered and 'false' if this arrangement doesn't match the user criteria.

Returns

TContainer

When<T1, T2, T3, T4, T5, T6>(Func<T1, T2, T3, T4, T5, T6, bool>)

Specifies an additional condition that must be true for this arrangement to be considered when the arranged member is called. This condition is evaluated in addition to the conditions imposed by any argument matchers in the arrangement.

This method allows a more general way of matching arrangements than argument matchers do.

Declaration

cs-api-definition
public TContainer When<T1, T2, T3, T4, T5, T6>(Func<T1, T2, T3, T4, T5, T6, bool> condition)

Parameters

condition

Func<T1, T2, T3, T4, T5, T6, bool>

A function that should return 'true' when this arrangement should be considered and 'false' if this arrangement doesn't match the user criteria.

Returns

TContainer

When<T1, T2, T3, T4, T5>(Func<T1, T2, T3, T4, T5, bool>)

Specifies an additional condition that must be true for this arrangement to be considered when the arranged member is called. This condition is evaluated in addition to the conditions imposed by any argument matchers in the arrangement.

This method allows a more general way of matching arrangements than argument matchers do.

Declaration

cs-api-definition
public TContainer When<T1, T2, T3, T4, T5>(Func<T1, T2, T3, T4, T5, bool> condition)

Parameters

condition

Func<T1, T2, T3, T4, T5, bool>

A function that should return 'true' when this arrangement should be considered and 'false' if this arrangement doesn't match the user criteria.

Returns

TContainer

When<T1, T2, T3, T4>(Func<T1, T2, T3, T4, bool>)

Specifies an additional condition that must be true for this arrangement to be considered when the arranged member is called. This condition is evaluated in addition to the conditions imposed by any argument matchers in the arrangement.

This method allows a more general way of matching arrangements than argument matchers do.

Declaration

cs-api-definition
public TContainer When<T1, T2, T3, T4>(Func<T1, T2, T3, T4, bool> condition)

Parameters

condition

Func<T1, T2, T3, T4, bool>

A function that should return 'true' when this arrangement should be considered and 'false' if this arrangement doesn't match the user criteria.

Returns

TContainer

When<T1, T2, T3>(Func<T1, T2, T3, bool>)

Specifies an additional condition that must be true for this arrangement to be considered when the arranged member is called. This condition is evaluated in addition to the conditions imposed by any argument matchers in the arrangement.

This method allows a more general way of matching arrangements than argument matchers do.

Declaration

cs-api-definition
public TContainer When<T1, T2, T3>(Func<T1, T2, T3, bool> condition)

Parameters

condition

Func<T1, T2, T3, bool>

A function that should return 'true' when this arrangement should be considered and 'false' if this arrangement doesn't match the user criteria.

Returns

TContainer

When<T1, T2>(Func<T1, T2, bool>)

Specifies an additional condition that must be true for this arrangement to be considered when the arranged member is called. This condition is evaluated in addition to the conditions imposed by any argument matchers in the arrangement.

This method allows a more general way of matching arrangements than argument matchers do.

Declaration

cs-api-definition
public TContainer When<T1, T2>(Func<T1, T2, bool> condition)

Parameters

condition

Func<T1, T2, bool>

A function that should return 'true' when this arrangement should be considered and 'false' if this arrangement doesn't match the user criteria.

Returns

TContainer

When<T1>(Func<T1, bool>)

Specifies an additional condition that must be true for this arrangement to be considered when the arranged member is called. This condition is evaluated in addition to the conditions imposed by any argument matchers in the arrangement.

This method allows a more general way of matching arrangements than argument matchers do.

Declaration

cs-api-definition
public TContainer When<T1>(Func<T1, bool> condition)

Parameters

condition

Func<T1, bool>

A function that should return 'true' when this arrangement should be considered and 'false' if this arrangement doesn't match the user criteria.

Returns

TContainer

In this article
DefinitionPropertiesIsMetMethodsAfterAll(params IPrerequisite[])CallOriginal()Dispose()DoInstead(Action)DoInstead(Delegate)DoInstead<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>)DoInstead<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>)DoInstead<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>)DoInstead<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>)DoInstead<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>)DoInstead<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>)DoInstead<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>)DoInstead<T1, T2, T3, T4, T5, T6, T7, T8, T9>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9>)DoInstead<T1, T2, T3, T4, T5, T6, T7, T8>(Action<T1, T2, T3, T4, T5, T6, T7, T8>)DoInstead<T1, T2, T3, T4, T5, T6, T7>(Action<T1, T2, T3, T4, T5, T6, T7>)DoInstead<T1, T2, T3, T4, T5, T6>(Action<T1, T2, T3, T4, T5, T6>)DoInstead<T1, T2, T3, T4, T5>(Action<T1, T2, T3, T4, T5>)DoInstead<T1, T2, T3, T4>(Action<T1, T2, T3, T4>)DoInstead<T1, T2, T3>(Action<T1, T2, T3>)DoInstead<T1, T2>(Action<T1, T2>)DoInstead<T1>(Action<T1>)DoNothing()IgnoreArguments()IgnoreInstance()InOrder(string)InSequence()MustBeCalled(string)Occurs(int, string)OccursAtLeast(int, string)OccursAtMost(int, string)OccursNever(string)OccursOnce(string)OnAllThreads()ProcessDoInstead(Delegate, bool)Raises(Action, EventArgs)Raises(Action, params object[])Raises<T1, T2, T3, T4>(Action, Func<T1, T2, T3, T4, EventArgs>)Raises<T1, T2, T3>(Action, Func<T1, T2, T3, EventArgs>)Raises<T1, T2>(Action, Func<T1, T2, EventArgs>)Raises<T1>(Action, Func<T1, EventArgs>)Throws(Exception)Throws<T>()Throws<T>(params object[])ThrowsAsync(Exception)ThrowsAsync<T>()ThrowsAsync<T>(params object[])When(Func<bool>)When<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, bool>)When<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, bool>)When<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, bool>)When<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, bool>)When<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, bool>)When<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, bool>)When<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, bool>)When<T1, T2, T3, T4, T5, T6, T7, T8, T9>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, bool>)When<T1, T2, T3, T4, T5, T6, T7, T8>(Func<T1, T2, T3, T4, T5, T6, T7, T8, bool>)When<T1, T2, T3, T4, T5, T6, T7>(Func<T1, T2, T3, T4, T5, T6, T7, bool>)When<T1, T2, T3, T4, T5, T6>(Func<T1, T2, T3, T4, T5, T6, bool>)When<T1, T2, T3, T4, T5>(Func<T1, T2, T3, T4, T5, bool>)When<T1, T2, T3, T4>(Func<T1, T2, T3, T4, bool>)When<T1, T2, T3>(Func<T1, T2, T3, bool>)When<T1, T2>(Func<T1, T2, bool>)When<T1>(Func<T1, bool>)
Not finding the help you need?
Contact Support