开发者

Clipboard access from NUnit-test

Is there a problem accessing the Windows Clipboard from an NUnit test?

I have a VB.NET application which calls System.Windows.Forms.Clipboard.GetText—it works fine in my normal exe, however there is no return value when running with NUnit console (x86).

The testfixture itself is marked with RequiresSTA().开发者_开发技巧

I use NUnit 2.5.9.


Is the console app running as a Windows service (e.g. under a CI server)? If so, this thread suggests that even though you are using STA, the service is most likely denied access to the desktop, which would be necessary for clipboard access.

Two of your options would be to enable desktop access for the service or to mock out the clipboard somehow for your tests.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜