Unit testing the view models in WPF

Jul 11, 2012 at 12:42 PM

How can we test the view models when using WPF when the DelegateCommands fire asynchronous code? I am currently using MS Test Framework with Moq. All of the services injected in the view model are having asynchronous operations using async pattern or backgroundworker and while they are being mocked using Moq, I see the tests failing at times due to possible race conditions. Any examples of view model unit tests on WPF?