加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c# – 如何将NUnit属性应用于程序集

发布时间:2020-12-15 08:45:57 所属栏目:百科 来源:网络整理
导读:根据文档,您可以将 NUnit timeout attribute应用于程序集: The attribute may also be specified on a fixture or assembly,in which case it indicates the default timeout for any subordinate test cases. 我遇到的挑战是,他们没有说明如何将该属性应用
根据文档,您可以将 NUnit timeout attribute应用于程序集:

The attribute may also be specified on a fixture or assembly,in which
case it indicates the default timeout for any subordinate test cases.

我遇到的挑战是,他们没有说明如何将该属性应用于该页面上的程序集或我在文档中可以找到的任何其他位置.

我尝试使用[SetupFixture]并使用属性进行装饰,但似乎没有.有没有人在制作类似这样的作品方面取得任何成功?

解决方法

要将Timeout属性应用于程序集,请首先使用NUnit.Framework添加指令;到程序集的AssemblyInfo.cs.然后添加一行指定超时:
[assembly: Timeout(1000)]

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读