-
Notifications
You must be signed in to change notification settings - Fork 274
Closed
Labels
feature-requestRequest for a new NSubstitute featureRequest for a new NSubstitute feature
Description
The problem is described here in comments under the answer: https://stackoverflow.com/questions/38338906/nsubstitute-mock-throwing-an-exception-in-method-returning-task
The problem with this is that the exception is thrown at the wrong time.
var t = AsyncMethod(); (actual behavior: exception will be raised here)
await t; (expected behavior: exception will be raised here)
With an async method the exception should be thrown when awaiting the task, Current approach throws the exception immediately.
Current behavior little bit unexpected in some cases. It would be great to correct it. Or may there is more elegant way to solve the problem.
Metadata
Metadata
Assignees
Labels
feature-requestRequest for a new NSubstitute featureRequest for a new NSubstitute feature