Unit Testing

There are 2 entries for the tag Unit Testing

UnitTesting Controller DataAnnotation Validation in MVC3 : ModelState.IsValid always true ?

Testing for ModelState.IsValid when unit testing your controller is not straightforward, since the Model Binding is responsible for validating you model. But Model Binding happens in OnActionExecuted filter (and NOT when you call your controller Action method). That means in your test context, Model Binding will not happen when you call your action method and ModelState.IsValid will always be true. But thanksfully, there is a solution below If we have the following simplistic model : public class ......

Unit Testing an MVVMLight Windows Phone 7.5 (Mango) application

If you're like me and are using MVVMLight to build Windows Phone apps, you probably want to unit test your ViewModels as well. One of the benefits of the MVVM pattern is the separation of concerns between the View (page holding the xaml layout and bindings) and the ViewModel which holds the data to be bound. This allows the ViewModel to be easily testable, or so they say. In the end, it is quite difficult to find some useable tutorial doing exactly that. To the point you might ask yourself : " do ......