MVVM
is the best choice for implementing unit tests compared with MVP
and MVC
because you can write test cases for both the ViewModel
and Model
layer without the need to reference the View and mock its objects.
MVP
is also a good architecture pattern but its weakness compared with MVVM
is you have reference to the View in your Presenter layer so you need to struggle with views reference in your Presenter unit tests.
MVC
testing is almost like MVP
but its main problem is that not only you have access to View
in the Controller
layer but you have access to the Model
layer in your View
as well that makes your testing harder.
Overall, as much as your code be decoupled writing unit tests is easier and MVVM architecture provides this decoupling to a great extent.