gpt4 book ai didi

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

转载 作者:太空狗 更新时间:2023-10-29 18:28:59 27 4
gpt4 key购买 nike

根据文档,您可以应用 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 属性应用于程序集,首先将指令 using NUnit.Framework; 添加到程序集的 AssemblyInfo.cs。然后添加一行指定超时:

[assembly: Timeout(1000)]

关于c# - 如何将 NUnit 属性应用于程序集,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27022353/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com