What a treat it is. We implemented a strict Passive View (MVP) pattern using WinForms, complete with NUnit tests and the whole enchilada (or shebang, whichever you prefer).
I tried to do the interleaved code thing here, and the interface sucks for that somehow. I want to attached a zip with the project in it, but WordPress won’t allow the filetype. Leave me a comment and I will e-mail the zip to you, or wait until I convert if all to a pdf(?).
How we did it:
Sketch a View (on paper)
OK, Imagine that we have a simple login form here; UsernameTextBox, PasswordTextBox, a LoginButton and a StatusMessageLabel. Very dull, but a nice short example with all the bits and pieces..
Create a first cut at an interface that reflects the functionality of the View:
What we have in this case is an interface called ILoginView. It has a declaration of a delegate for the LoginButton, get/set properties for Username and Password, a set property for StatusMessage, and a LoginClick event declaration.
Start writing tests that exercise the interface:
There are tests to validate that the Presenter can exercise the View through the interface. I use a stub view that is just a class that implements ILoginView.
Create the Presenter class to satisfy the tests via the interface..
Lather, rinse, repeat.
Once you have the View’s interface implemented in tests, and you have near 100% coverage, now you can create your WinForm View (implementing View’s interface); and plug in the UI functionality.