开发者

MVP : Dialog boxes that return value and testable code

开发者 https://www.devze.com 2022-12-21 01:04 出处:网络
In my MVP pattern (Passive view) based application (.NET), I have separated out the message boxes into the View so that when I tes开发者_运维问答t my presenter and model my testing code is not affecte

In my MVP pattern (Passive view) based application (.NET), I have separated out the message boxes into the View so that when I tes开发者_运维问答t my presenter and model my testing code is not affected by the need to show user some information. But I don't know how to accommodate dialog boxes, when user's input is required to decide on a course of action. So, how do we make dialog boxes work in MVP?


You can make the tests work by mocking the View while testing the presenter. Mocking allows you to return values for a given method of the View and thus simulating the user input.

0

精彩评论

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