views:

41

answers:

1

How do you build WPF MVVM applications and user controls test-first?

I find myself writing ungodly amounts of XAML with DataTemplates before I even get to unit-testing my viewmodels. Should I develop the whole viewmodel system first before even writing XAML for it?

Any help appreciated.

+1  A: 

If you're writing up your XAML and data templates first, it sounds like you are already coding up the user-interface. But MVVM provides for clean separation of UI and business logic (i.e., your business logic should be completely decoupled from the user interface logic). So to answer your question, yes, you should develop the model and view-model first, and unit test them thoroughly, before implementing the view.

Charlie