Code coverage for async methods

后端 未结 4 1197
刺人心
刺人心 2021-01-17 17:50

When I analyse code coverage in Visual Studio 2012, any of the await lines in async methods are showing as not covered even though they are obviously executing since my test

4条回答
  •  余生分开走
    2021-01-17 18:21

    This can happen most commonly if the operation you're awaiting is completed before it's awaited.

    I recommend you test at least synchronous and asynchronous success situations, but it's also a good idea to test synchronous and asynchronous errors and cancellations.

提交回复
热议问题