开发者

How to handle dialog through unit tests?

开发者 https://www.devze.com 2023-01-31 13:30 出处:网络
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 th

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

精彩评论

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