如何单元测试的WinForms应用 [英] How to unit test winforms applications
问题描述
由于ASP.NET MVC框架,就有可能单元测试Web应用程序。但你如何单元测试Windows窗体应用程序?
Thanks to ASP.NET MVC framework, it became possible to unit test web applications. But how do you unit test windows forms applications?
推荐答案
一种方法是使用模型 - 视图 - presenter(MVP)模式的Winforms应用程序。 pretty的容易,如果你已经用MVC工作适应
One way is to use Model View Presenter (MVP) Patterns for Winforms app. Pretty easy to adapt if you already worked with MVC
具体而言,采取的视图部分 MVC和切片它尽可能薄 所以,只有一个周围的皮肤 实际的UI组件,使它 完全被动的。控制器, 现在所谓的presenter,是 负责与所有交互 该系统的其余部分
Specifically, take the view part of MVC and slice it as thin as possible so that it is only a skin around the actual UI components and make it completely passive. The controller, now called the "presenter," is responsible for all interaction with the rest of the system.
看了一些伟大的文章从。
Read some great articles from.
快乐编码
这篇关于如何单元测试的WinForms应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!