如何从代码覆盖范围中排除异步委托

时间:2019-01-03 16:10:22

标签: code-coverage

我正在使用c#dotnet core 2.1控制台应用程序。我的类具有[ExcludeFromCodeCoverage]属性,但是仍在考虑该类中某个方法内的异步委托进行代码覆盖。我正在使用Coverlet作为代码覆盖率生成器。如何排除异步委托?

[ExcludeFromCodeCoverage]
public class DuplicateDetectionService
{
   public virtual async Task ExampleMethod()
   {
        var retryPolicy = Policy
                 .Handle<SocketException>()
                 .Or<HttpRequestException>()
                 .WaitAndRetryAsync(5, i => TimeSpan.FromSeconds(5));
       await retryPolicy.ExecuteAsync(async () =>
       {
            //Some code which is included in code coverage
       }
   }
}

0 个答案:

没有答案