Josh Smith has great article on his approach to building "unit test-friendly" WPF applications by using the Model View Controller (MVC) pattern. I just love this statement from the article:
"If you put ten software architects into a room and have them discuss what the Model-View-Controller pattern is, you will end up with twelve different opinions. In the next section of this article, I provide my definition of MVC. Some of the purists out there will inevitably have qualms with what I refer to as ‘MVC.’ Feel free to leave a flaming comment on the message board at the bottom of this Web page. I will gladly entertain different perspectives on what MVC means, but keep in mind that I do not care. I am too busy getting work done to care about the ‘philosophically ideal’ definition and implementation of MVC."
I have always felt that software architecture patterns should be your friend, not your enemy. You use certain approaches because they work and solve a problem. If they don’t, modify them so they do. Seems pretty simple to me. However, I’ve wasted too much time in my life before Microsoft arguing with "fellow architects" about the "philosophically ideal" elements of software design/architecture. That’s time that could have been used to actually contribute to shipping something! I have read through Josh’s article and went through his accompanying sample. Regardless of your opinion of what is the "right way" to implement MVC, his approach is a solid, proven way of setting up a structure which allows you to unit test your WPF applications.
UPDATE: Here’s the direct link to the post.