MVC training day 2

Back for more! We started the day with a quick look at Dynamic Data (no more than an overview for those that hadn't seen it before), then moved on to look at unit testing the MVC framework, before finishing off with a look at jQuery and how it works with MVC.

Unit Testing

We looked at unit testing using NUnit and Moq. It was the first time I'd used Moq and it was interesting seeing just how well the approach fits with MVC. Essentially the idea was to be able to simulate the whole HTTP Context outside of a web server, using mock objects. Steven had written a helper class that mocked up the various parts of things like the request that would be needed to let a web application run successfully. This worked very neatly and allows you to push on in a rather succinct way with your testing and write very nicely structured tests that achieve good coverage of your controllers. Obviously, this does not cover unit testing of the views, but that's a slightly different problem.

jQuery

I've used jQuery before on 'Classic' ASP.NET projects, but it's pretty good seeing how easily it fits in with the MVC framework. The tighter control of the HTML output you get with MVC certainly lends itself much more readily to jQuery manipulation. No more worrying about exactly what the ClientID is going to be!

Steven commented that the word on the street was the Microsoft are saying that they're going to be introducing some sort of AJAX compatibility layer before MVC goes RTM, but it's not yet clear what that's going to be.

1 Comment

  • I hope you found the MVC training interesting - it was good meeting you.

    If you have any thoughts on what we *didn't* cover so well, I'd be interested to hear about it so I can streamline my coverage in the book or in other training sessions.

    Cheers!

Comments have been disabled for this content.