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.
精彩评论