RajOpteamix / moq

Automatically exported from code.google.com/p/moq
Other
0 stars 0 forks source link

Allow seting up async methods easily #373

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
It would be nice to have better usability for methods that return Task.

For example, an option for doing something like:

myMock.Setup(x => x.ReadAsync()).ThrowsAsync(new Exception());

which should return a faulted task with that exception.

Also, for methods that return Task that are not explicitly set up, it would be 
good that instead of defaulting to return a null Task, that they return a 
completed Task (or completed Task<T>) instead.

Original issue reported on code.google.com by julian...@gmail.com on 4 Dec 2013 at 6:54