New to Telerik JustMockStart a free 30-day trial

Provides methods for arranging exceptions to be thrown when a mocked member is called.

Definition

Namespace:Telerik.JustMock.Expectations.Abstraction

Assembly:Telerik.JustMock.dll

Type Parameters:

TContainer

Expectation type that continues the arrangement.

Syntax:

C#
public interface IThrows<TContainer>

Derived Classes: ActionExpectationCollectionExpectation<TReturn>CommonExpectation<TContainer>FuncExpectation<TReturn>FuncExpectation<TReturn>

Methods

Throws the specified exception when the arranged call occurs.

C#
IAssertable Throws(Exception exception)
Parameters:exceptionException

Exception instance to throw.

Returns:

IAssertable

The current expectation so that you can continue the arrangement.

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

C#
IAssertable Throws<TException>() where TException : Exception
Returns:

IAssertable

The current expectation so that you can continue the arrangement.

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

C#
IAssertable Throws<TException>(params object[] args) where TException : Exception
Parameters:argsobject[]Returns:

IAssertable

The current expectation so that you can continue the arrangement.

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

C#
IAssertable ThrowsAsync(Exception exception)
Parameters:exceptionException

Exception instance to use for the faulted task.

Returns:

IAssertable

The current expectation so that you can continue the arrangement.

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

C#
IAssertable ThrowsAsync<TException>() where TException : Exception
Returns:

IAssertable

The current expectation so that you can continue the arrangement.

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

C#
IAssertable ThrowsAsync<TException>(params object[] args) where TException : Exception
Parameters:argsobject[]Returns:

IAssertable

The current expectation so that you can continue the arrangement.