Views Testability Guidance
This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies.
Traditional ASP.NET Web applications contain a large amount of user interface (UI) logic within the pages themselves. This makes that logic hard or impossible to unit test; frequently, it leaves the UI in a brittle state, where changes to the UI often break the logic. The Model-View-Presenter (M-V-P) pattern provides a way for developers to separate the UI logic from the Web page and encapsulate it into a form that is easier to test. Additionally, this separation makes the UI-centric business logic less prone to break as changes are made to the UI.
There are several different variants of the Model-View-Presenter pattern, including Passive View and Supervising Controller. There are also other patterns of UI design such as Model-View-Controller. Model-View-Controller and Model-View-Presenter have similar goals, although there are differences in how they achieve those goals.
The purpose of the Views Testability guidance is to provide information about how to increase the testability surface of Web applications using the M-V-P pattern.
What Is in This Guidance?
The Model-View-Presenter Guidance contains the following elements:
- Model-View-Presenter Pattern. This topic explains how the Model-View-Presenter pattern allows you to separate the visual behavior and the event-handling logic into separate classes.
- ObjectContainerDataSource Control. This topic explains how the ObjectContainerDataSource control integrates data binding with the Model-View-Presenter pattern.
- How to: Implement the Model-View-Presenter Pattern. This topic demonstrates how to implement a presenter class, a view interface and a view class.
- How to: Unit Test a Presenter. This topic demonstrates how, when you implement the Model-View-Presenter pattern, you can test the presenter independently of the concrete implementations of the view and the model.
- Model-View-Presenter QuickStarts. This topic demonstrates how to implement the Model-View-Presenter pattern and how to implement it in a composite Web client solution. The second QuickStart relies on the dependency injection mechanism that is part of the Composite Web Application Block.