I working with MOQ framework for my testing. I have a scenario in which I expect a fault exception to be thrown. How can I verify it was thrown?
public void
Please read this Introduction to Moq. Here is the way to setup InvalidOperationException throwing when DoSomething method is invoked:
mock.Setup(foo => foo.DoSomething()).Throws();
Then simply verify if method was called. If it was called, then exception was raised
mock.Verify(foo => foo.DoSomething());