small medium large xlarge

Test-Drive ASP.NET MVC


Cover image for Test-Drive ASP.NET MVC

Test-Drive ASP.NET MVC


It’s testable. It’s light-weight. It’s open-source. It’s . . . Microsoft?

Yes, finally, Microsoft has figured it out. ASP.NET MVC 2.0 lets you test drive your code, control the output of your HTML, and leverage C# and .NET in an easy-to-use web framework. This book shows you all you need to know to get started developing web applications using test-driven development (TDD). You’ll learn how to do everything from creating your first test, to building REST web services, to deploying your finished ASP.NET MVC applications. Test-Drive ASP.NET MVC gets you started with all the fundamentals you need, whether you’re transitioning from older Microsoft technologies, or if you’re coming from an open-source background and are curious about what ASP.NET MVC has to offer.

Customer Reviews

Every developer should understand what MVC is all about. Jonathan’s friendly, clear writing style, the practical examples, and the helpful best-practice guidance combine to make this book a must-read for every ASP.NET developer.

- Jeff Cohen

, Purple Workshops

ASP.NET MVC represents a great leap forward for .NET developers looking to produce more deterministic (bug-free) applications. In an
eerie parallel that’s almost certainly intentional, Jonathan’s book represents a great leap forward for .NET developers looking to produce ASP.NET MVC code quickly, cleanly, and correctly. Highly recommended.

- Ted Neward

Principal, Neward & Associates

Test-Drive ASP.NET MVC is a great introduction to a whole raft of techniques for building applications that leverage the ASP.NET MVC
framework. The book explores aspects of producing web-based applications in the context of MVC, making sure to point out a good set of tools that you can choose to augment your application development process.

- Jean-Paul Boodhoo

Founder, Nothin’ but .NET Developer Bootcamp

Test-Drive ASP.NET MVC is a fantastic introduction to the way ASP.NET MVC applications were meant to be developed—in a test-first fashion. Jonathan gently introduces the reader to both ASP.NET MVC 2 and TDD, with just the right dash of ReSharper tips and tricks thrown in for good measure. Highly recommended for those new to ASP.NET MVC or TDD!

- James Kovacs

President, Consulting and Microsoft MVP, ASP/ASP.NET

See All Reviews

About this Title

Pages: 296
Published: 2010-06-30
Release: P1.1 (2010-09-28)
ISBN: 978-1-93435-653-1

ASP.NET MVC 2.0 is C# on the web done right. No more fiddling around with Viewstate, IsPostBack(), and drag-and-drop coding. Microsoft has addressed the shortcomings of ASP.NET and created a framework that goes toe-to-toe with other popular web frameworks such as Ruby on Rails. Programming in C# is fun again!

This book uses a test-driven development (TDD) approach to the features of ASP.NET MVC. You’ll get hands-on experience building and deploying a time-management web application from start to finish. From building your first page, to data access, to integrating with web services such as, Test-Drive ASP.NET MVC guides you step by step. You’ll come away with a complete understanding of web services and data access, and you’ll learn how to test each component so that your code is bug-free and maintainable from the start. You’ll see how to handle security, logging, and error handling. Then, you’ll protect your site with ASP.NET MVC’s advanced security features.

Software isn’t useful until it’s deployed into production. We’ll cover automated deployment using MSBuild, a build tool product that can help you get your site online, repeatably and reliably. Throughout, you’ll work with open source projects that complement ASP.NET MVC, including NHibernate, MVCContrib, and Castle Windsor Container. These tools speed up developing database components, architecture layers, and testing your code.

As you build and deploy your application, you’ll not only learn the framework itself, but also gain valuable experience with the test-first methodology, driving your application development through small and measurable incremental improvements.

Special offer

Readers of Test-Drive ASP.NET MVC by Jonathan McCracken are eligible for a free license (valued at over $1,000.00) of Syncfusion’s UI controls, along with a 90-day support subscription.

Syncfusion’s User Interface Edition for ASP.NET MVC allows you to create high performance AJAX Web applications with ease. Give your web applications a 360° transformation with Syncfusion’s ASP.NET MVC user interface controls! Get it from here

Contents & Extracts

Full Table of Contents


  • Fundamentals
    • Getting Started with ASP.NET MVC
    • Test-Driven Development
  • Building an Application
    • Getting Organized with MVC excerpt
    • Working with Controllers
    • Managing State and Files with Controllers excerpt
    • Enhancing Views with HTML Helpers and Master Pages
    • Composing Views with Ajax and Partials
  • Integrating with Other Frameworks
    • Persisting Your Models
    • Integrating Repositories with Controllers
    • Building RESTful Web Services
  • Security and Deployment
    • Security, Error Handling, and Logging
    • Build and Deployment
    • Bibliography


Jonathan McCracken is the Director of Services with ThoughtWorks Canada. He has developed .NET applications for a wide range of companies, including Microsoft. Jonathan has been developing software since 1994 and his .NET experience goes all the way back to .NET 1.0 in 2002. In addition to his professional activities, Jonathan enjoys speaking and blogging about diverse topics such as technology and the meaning of life (