Jason Dolinger Model-View-ViewModel Screencast
Jason Dolinger’s a presentation on design in WPF(also applicable to Silverlight) with the Model-View-ViewModel pattern and the Unity dependency injection framework.
Jason started with an application that one would write in a “traditional” way, with button clicks handled by event-handlers in the code-behind that then updated other parts of the UI. Using WPF data-binding, Commands, and Unity, he transformed it, piece by piece, in a much more manageable, encapsulated, readable, and testable M-V-VM design. It was awesome.
Traditional way 6:00 – 13:00
MVP 13:30 – 17:00
MVVP Overview 17:17 – 22:00
Impl 22:30
ViewModel 23:26
ICommand 45:15
Unit Test 51:30
Moq Mocking Framework the DataSource 52:43 – 57:30
Dependency Injection – Unity – App.xaml 57:45 – 1:09:45
Static Data display in Expression Blend 1:10:15
Create a Row-level ViewModels for Grid & ItemSources control 1:15:50Note: Jason creates ViewModels that are DependencyObjects. However,DataContexts in Silverlight cannot be DependencyObject descendants. That means that you need to implement ViewModels as INotifyPropertyChanged.
Silverlight does not support bindings for Commands out of the box. It does, however, expose the ICommand interface. With just a little bit more work using an “Attached Behavior” approach, we can get the kind of Commanding that Jason uses in Silverlight as well. Check out the description here.
Introduction to the simplest Mock Framework for .NET – Moq
-
Screencasts – Introduction to Mocking with Moq
-
Basic Mocking with Moq
Methods
Matching Arguments
Properties
Callbacks
Verification
Also…
API (lots of examples) - API documentation
Stephen Walter - TDD : Introduction to Moq
