Using NSubstitute, how do you mock an exception being thrown in a method returning a Task?
Let's say our method signature looks something like this:
Task<List<object>> GetAllAsync();
Here's how NSubstitute docs say to mock throwing exceptions for non-void return types. But this doesn't compile :(
myService.GetAllAsync().Returns(x => { throw new Exception(); });
So how do you accomplish this?
> List
– Carlos Liu Dec 03 '18 at 07:21