1 / 11

Testing WebForms w/ Model-View-Presenter

Testing WebForms w/ Model-View-Presenter. Erik Peterson. What is MVP?. A design pattern, similar to Model-View-Controller, which allows for separation of concerns Allows for testability via the Presenter. MVP vs MVC. The MVC way (code-behind):

Download Presentation

Testing WebForms w/ Model-View-Presenter

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Testing WebForms w/Model-View-Presenter Erik Peterson

  2. What is MVP? • A design pattern, similar to Model-View-Controller, which allows for separation of concerns • Allows for testability via the Presenter

  3. MVP vs MVC • The MVC way (code-behind): • In the beginning, we had code-behind, and it was good • Business logic wound up closely tied to the UI • The new ASP.NET MVC Framework • Gets rid of the .NET heavy-weight webform model

  4. MVP vs MVC • The MVP way: • Model is the same • View is the .aspx and code-behind • Controller is the Presenter • Still have the webform model

  5. Model • Where the data lives • Defines structure and relation of data in your system

  6. View • Handles the UI • Contains the controls (server, HTML, etc) • Handles data rendering, layout, etc • Implements interface to allow communication with the Presenter

  7. Presenter • Where the business logic lives • Interacts with model to retrieve relevant data • Passes data to the view, retrieves necessary info from the view • Can use dependency injection for testability

  8. MVP From Up High View Model Presenter

  9. Our Demo • We want to view a list of players on our football team • We want to be able to add a player to our team • We want to be able to remove a player from our team

  10. Where do we begin? Retrieving players, load them to the view Front end vs. Back end And now, to the code!

  11. Questions? Blog: http://erikbase.blogspot.com/ Email: cerikpete@gmail.com

More Related