开发者

How to handle dialog through unit tests?

i am开发者_Python百科 writing unit test for a C# project. One of the event handler raises a kind of Save as dialog wherein I have to enter a path and file name. On it's ok click, I want to receive this string. How can I handle this.

thanks, kapil


You don't want the UI to actually appear during a unit test. At that point, it's no longer a unit test. If you really want to test the UI, unit testing is not the place for it, instead use a UI testing framework. If you want to test some functionality underlying the UI, you will need to redesign your program so that whatever code is executing as a result of UI actions is independently testable.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜