↧
Answer by Stephen Cleary for Moq Throw async exception in one of tasks in...
As Bruno correctly pointed out, the problem is that the mocked StartAsync is throwing an exception synchronously, not returning a faulted task.However, the correct code cannot use new Task (which will...
View ArticleAnswer by Bruno Garcia for Moq Throw async exception in one of tasks in call...
Task.WhenAll will call StartAsync, that will throw.The exception is thrown on the calling thread. Before a task could be created.You want StartAsync to return a Task:firstProcessor.Setup(x =>...
View ArticleMoq Throw async exception in one of tasks in call to Task.WhenAll
I have a number of Tasks that I am passing to a Task.WhenAll call. In my tests, I am setting up the first task to throw an exception, but my call to Tasks.WhenAll is not completed for all the tasks and...
View Article