从.net-core中的代码覆盖范围中排除类或方法
问题描述:
我知道我可以使用[ExcludeFromCodeCoverage]来排除.Net Framework 4中的代码覆盖率。
I know i can used [ExcludeFromCodeCoverage] to exclude code coverage in .Net framework 4.
有人知道我是否有办法从中排除代码覆盖率。 dotnet核心?
Does anyone know if there's a way i can exclude code coverage from .dotnet core?
答
自.NET Core 2.0起,您可以使用 ExcludeFromCodeCoverage
属性。 / p>
Since .NET Core 2.0 you can use ExcludeFromCodeCoverage
attribute.
using System.Diagnostics.CodeAnalysis;
namespace YourNamespace
{
[ExcludeFromCodeCoverage]
public class YourClass
{
...
}
}
https://isscroberto.com/2019/07/11/net-core-exclude-from-coverage/