作者热门文章
- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
我想测试一个使用剪贴板 (WindowsForms) 的应用程序,我的单元测试中也需要剪贴板。为了使用它,它应该在 STA 模式下运行,但是由于 NUnit TestFixture
没有 main 方法,我不知道在哪里/如何注释它。
最佳答案
如果你使用的是nunit 2.5+,你可以在类中使用新的RequiresSTAAttribute
[TestFixture, RequiresSTA]
或汇编级。
[assembly:RequiresSTA]
不需要配置文件。查看: http://www.nunit.org/index.php?p=requiresSTA&r=2.5
关于c# - 如何在 STAThread 模式下运行单元测试?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2434067/
我是一名优秀的程序员,十分优秀!