从.net-core中的代码覆盖范围中排除类或方法 [英] Exclude class or method from code coverage in .net-core

查看:233
本文介绍了从.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/

这篇关于从.net-core中的代码覆盖范围中排除类或方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆