I am trying to use nunits new way of exception handling but I am finding it hard to find information on it and how to also use it with moq.
I have right now moq that throws a exception on a mocked method but I don't know how to use nunit to catch it and look at it.
Why can't you enclose the mocked method call in a try/catch block and catch the specific exception being thrown?
Best way to mention is:
[ExpectedException(typeof(ApplicationException))]
above the test method.There's a few different ways to do it; I use Assert.Throws.
e.g.
You can then query the exception object further if you want, e.g.