Implements common expectations.
Definition
Namespace:Telerik.JustMock.Expectations
Assembly:Telerik.JustMock.dll
Type Parameters:
TContainer
Syntax:
public class CommonExpectation<TContainer> : IAction<TContainer>, IDoInstead<TContainer>, IThrows<TContainer>, IAssertable, IMustBeCalled, ISetupBehavior, IOccurrence, IOrder, IPrerequisite, IDisposable, IInstanceScope<TContainer>
Inheritance: objectCommonExpectation<TContainer>
Derived Classes:
Implements:
Properties
Methods
Specifies that a call should occur only after all of the given prerequisites have been met.
public IAssertable AfterAll(params IPrerequisite[] prerequisites)
Implements:
Calls the original implementation when the arranged call occurs.
public IAssertable CallOriginal()
The current expectation so that you can continue the arrangement.
Implements:
Removes this arrangement. Its side effects will no longer be executed and its expectations will not be asserted.
public void Dispose()
Implements:
Runs the supplied delegate instead of the arranged member body.
public TContainer DoInstead(Action action)
Delegate to run when the arranged call occurs.
Returns:TContainer
The current expectation so that you can continue the arrangement.
Implements:
Runs the supplied delegate instead of the arranged member body.
public TContainer DoInstead(Delegate @delegate)
Delegate to run when the arranged call occurs.
Returns:TContainer
The current expectation so that you can continue the arrangement.
Implements:
Specifies the delegate that will execute for the expected method.
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)
Target action delegate to execute as method body
Returns:TContainer
Implements:
Specifies the delegate that will execute for the expected method.
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)
Target action delegate to execute as method body
Returns:TContainer
Implements:
Specifies the delegate that will execute for the expected method.
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)
Target action delegate to execute as method body
Returns:TContainer
Implements:
Specifies the delegate that will execute for the expected method.
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)
Target action delegate to execute as method body
Returns:TContainer
Implements:
Specifies the delegate that will execute for the expected method.
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)
Target action delegate to execute as method body
Returns:TContainer
Implements:
Specifies the delegate that will execute for the expected method.
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)
Target action delegate to execute as method body
Returns:TContainer
Implements:
Specifies the delegate that will execute for the expected method.
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)
Target action delegate to execute as method body
Returns:TContainer
Implements:
Specifies the delegate that will execute for the expected method.
public TContainer DoInstead<T1, T2, T3, T4, T5, T6, T7, T8, T9>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9> action)
Target action delegate to execute as method body
Returns:TContainer
Implements:
Specifies the delegate that will execute for the expected method.
public TContainer DoInstead<T1, T2, T3, T4, T5, T6, T7, T8>(Action<T1, T2, T3, T4, T5, T6, T7, T8> action)
Target action delegate to execute as method body
Returns:TContainer
Implements:
Specifies the delegate that will execute for the expected method.
public TContainer DoInstead<T1, T2, T3, T4, T5, T6, T7>(Action<T1, T2, T3, T4, T5, T6, T7> action)
Target action delegate to execute as method body
Returns:TContainer
Implements:
Specifies the delegate that will execute for the expected method.
public TContainer DoInstead<T1, T2, T3, T4, T5, T6>(Action<T1, T2, T3, T4, T5, T6> action)
Target action delegate to execute as method body
Returns:TContainer
Implements:
Specifies the delegate that will execute for the expected method.
public TContainer DoInstead<T1, T2, T3, T4, T5>(Action<T1, T2, T3, T4, T5> action)
Target action delegate to execute as method body
Returns:TContainer
Implements:
Specifies the delegate that will execute for the expected method.
public TContainer DoInstead<T1, T2, T3, T4>(Action<T1, T2, T3, T4> action)
Target action delegate to execute as method body
Returns:TContainer
Implements:
Specifies the delegate that will execute for the expected method.
public TContainer DoInstead<T1, T2, T3>(Action<T1, T2, T3> action)
Target action delegate to execute as method body
Returns:TContainer
Implements:
Specifies the delegate that will execute for the expected method.
public TContainer DoInstead<T1, T2>(Action<T1, T2> action)
Target action delegate to execute as method body
Returns:TContainer
Implements:
Specifies the delegate that will execute for the expected method.
public TContainer DoInstead<T1>(Action<T1> action)
Target action delegate to execute as method body
Returns:TContainer
Implements:
Leaves the arranged void call without additional behavior.
public IAssertable DoNothing()
The current expectation so that you can continue the arrangement.
Implements:
Use this method when you want the call to succeed without throwing or running custom logic. Loose mocks already behave this way by default.
Specifies to ignore any argument for the target call.
public TContainer IgnoreArguments()
TContainer
Func or Action Container
Defines that the expectation should occur for all instance.
public TContainer IgnoreInstance()
TContainer
Implements:
Specifies a call should occur in a specific order.
Specifies that JustMock should invoke different mock instance for each setup.
public IAssertable InSequence()
Implements:
When this modifier is applied for similar type call, the flow of setups will be maintained.
Specifies that the arranged member must be called. Asserting the mock will throw if the expectation is not fulfilled.
public IDisposable MustBeCalled(string message = null)
Implements:
Specifies that the call must never occur.
public IDisposable OccursNever(string message = null)
Implements:
Specifies that the call must occur once.
public IDisposable OccursOnce(string message = null)
Implements:
Specifies that the arrangement will be respected regardless of the thread on which the call to the arranged member happens.
public IAssertable OnAllThreads()
Implements:
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.
Raises the specified event when the arranged call occurs.
public TContainer Raises(Action eventExpression, EventArgs args)
Expression that identifies the event to raise.
argsEventArgsEvent arguments to pass to the handler.
Returns:TContainer
The current expectation so that you can continue the arrangement.
Exceptions:Thrown when JustMock cannot resolve the event expression.
Implements:
Raises the specified event when the arranged call occurs.
public TContainer Raises(Action eventExpression, params object[] args)
Expression that identifies the event to raise.
argsobject[]Arguments to pass to the event handler delegate.
Returns:TContainer
The current expectation so that you can continue the arrangement.
Implements:
Raises the specified event when the arranged call occurs.
public TContainer Raises<T1, T2, T3, T4>(Action eventExpression, Func<T1, T2, T3, T4, EventArgs> func)
Expression that identifies the event to raise.
funcFunc<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:Thrown when JustMock cannot resolve the event expression.
Implements:
Raises the specified event when the arranged call occurs.
public TContainer Raises<T1, T2, T3>(Action eventExpression, Func<T1, T2, T3, EventArgs> func)
Expression that identifies the event to raise.
funcFunc<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:Thrown when JustMock cannot resolve the event expression.
Implements:
Raises the specified event when the arranged call occurs.
public TContainer Raises<T1, T2>(Action eventExpression, Func<T1, T2, EventArgs> func)
Expression that identifies the event to raise.
funcFunc<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:Thrown when JustMock cannot resolve the event expression.
Implements:
Raises the specified event when the arranged call occurs.
public TContainer Raises<T1>(Action eventExpression, Func<T1, EventArgs> func)
Expression that identifies the event to raise.
funcFunc<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:Thrown when JustMock cannot resolve the event expression.
Implements:
Throws the specified exception when the arranged call occurs.
public IAssertable Throws(Exception exception)
Exception instance to throw.
Returns:The current expectation so that you can continue the arrangement.
Implements:
Throws a new exception of the specified type when the arranged call occurs.
public IAssertable Throws<T>() where T : Exception
The current expectation so that you can continue the arrangement.
Implements:
Throws a new exception of the specified type when the arranged call occurs.
public IAssertable Throws<T>(params object[] args) where T : Exception
Arguments to pass to the exception constructor.
Returns:The current expectation so that you can continue the arrangement.
Implements:
Faults the returned task with the specified exception when the arranged async call occurs.
public IAssertable ThrowsAsync(Exception exception)
Exception instance to use for the faulted task.
Returns:The current expectation so that you can continue the arrangement.
Implements:
Faults the returned task with a new exception of the specified type when the arranged async call occurs.
public IAssertable ThrowsAsync<T>() where T : Exception
The current expectation so that you can continue the arrangement.
Implements:
Faults the returned task with a new exception of the specified type when the arranged async call occurs.
public IAssertable ThrowsAsync<T>(params object[] args) where T : Exception
Arguments to pass to the exception constructor.
Returns:The current expectation so that you can continue the arrangement.
Implements:
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.
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.
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)
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
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.
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)
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
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.
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)
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
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.
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)
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
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.
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)
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
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.
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)
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
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.
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)
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
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.
public TContainer When<T1, T2, T3, T4, T5, T6, T7, T8, T9>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, bool> condition)
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
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.
public TContainer When<T1, T2, T3, T4, T5, T6, T7, T8>(Func<T1, T2, T3, T4, T5, T6, T7, T8, bool> condition)
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
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.
public TContainer When<T1, T2, T3, T4, T5, T6, T7>(Func<T1, T2, T3, T4, T5, T6, T7, bool> condition)
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
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.
public TContainer When<T1, T2, T3, T4, T5, T6>(Func<T1, T2, T3, T4, T5, T6, bool> condition)
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
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.
public TContainer When<T1, T2, T3, T4, T5>(Func<T1, T2, T3, T4, T5, bool> condition)
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
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.
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.
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.
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.