MOQ: Throwing exception that was passed into a method

Viewed 971

I have a method on an interface:

void HandleError(MyClasss c, object o, Exception e);

I want to mock this with MOQ, and on any parameters throwing the supplied Exception e.

Something like:

_mock.Setup(a => a.HandlreError(It.IsAny<MyClass>(), It.IsAny<object>()
   , It.IsAny<Exception>())).Throws( [the 'any' exception] )
1 Answers
Related