Unit Testing Asp.net and Asp.net MVC
-
Upload
gil-zilberfeld -
Category
Technology
-
view
896 -
download
3
description
Transcript of Unit Testing Asp.net and Asp.net MVC
![Page 1: Unit Testing Asp.net and Asp.net MVC](https://reader036.fdocuments.in/reader036/viewer/2022082605/554fb755b4c9050e7d8b4642/html5/thumbnails/1.jpg)
Gil Zilberfeld
Unit Testing ASP.Net and ASP.Net MVC
23-Nov-2011
![Page 2: Unit Testing Asp.net and Asp.net MVC](https://reader036.fdocuments.in/reader036/viewer/2022082605/554fb755b4c9050e7d8b4642/html5/thumbnails/2.jpg)
Agenda
• What is different from testing regular apps• The performance hit of testing with a browser• What’s new in MVC that makes it more testable• What still remains in MVC that’s still hard to test• What needs to be tested – logic• Example – testing what’s written to the client• Example – testing an MVC controller• Example – testing for security logging• Example – testing control logic with Ivonna• Call to action – download Isolator.Net and Ivonna
![Page 3: Unit Testing Asp.net and Asp.net MVC](https://reader036.fdocuments.in/reader036/viewer/2022082605/554fb755b4c9050e7d8b4642/html5/thumbnails/3.jpg)
ASP.Net apps hard to test
• Rely on server state• HttpContext and friends
• Testing through browser is:• Slow to run• Hard to debug
• ASP.Net is not test-friendly• HttpContext and friends
![Page 4: Unit Testing Asp.net and Asp.net MVC](https://reader036.fdocuments.in/reader036/viewer/2022082605/554fb755b4c9050e7d8b4642/html5/thumbnails/4.jpg)
And MVC?
• More test-friendly• Works through interfaces• BaseHttpContext
• But not completely• For example: Redirection• And your code
![Page 5: Unit Testing Asp.net and Asp.net MVC](https://reader036.fdocuments.in/reader036/viewer/2022082605/554fb755b4c9050e7d8b4642/html5/thumbnails/5.jpg)
Examples
• ASP.Net
![Page 6: Unit Testing Asp.net and Asp.net MVC](https://reader036.fdocuments.in/reader036/viewer/2022082605/554fb755b4c9050e7d8b4642/html5/thumbnails/6.jpg)
Questions?
www.typemock.com
blog.typemock.com
@typemock
www.gilzilberfeld.com
@gil_zilberfeld