开发者

Clipboard access from NUnit-test

开发者 https://www.devze.com 2023-02-04 13:10 出处:网络
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

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

精彩评论

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