views:

82

answers:

2

also, what day is today and why do I have an ugly unicorn as my avatar ;-)

A: 

You have a unicorn because today is April Fools Day and Jeff is a sucker for that kind of thing.

Some wold say an MVC site is more testable than a ASP.NET Forms one. You make it testable by adding tests I guess.

HollyStyles
I don't understand why this was down voted, up voting to off set it.
Sayed Ibrahim Hashimi
+6  A: 

First, you have to use sealed classes and singletons everywhere -- none of these wrapper classes with virtual methods that can be mocked out or anything. Next, and this is important, you have to use Reponse.Write instead of returning views. It also helps to serialize the contents of all of the form parameters, encrypt them, and store them in a hidden input on the page -- then always check the new parameters against the old ones to see which things changed. Using this way you can generate these things called "events" -- they're just like button clicks and selects on Windows Forms. These are much easier to understand and simulate in your unit tests.

tvanfosson
thanks! so basically I have to start by making all of my classes static correct? making sure it is next to impossible to mock them... thanks, that's a start :)
Ricardo
yep -- then make sure you have several events in your controller that have to be invoked in the proper sequence to "set up" the state of your controller. I'd suggest events like "Init", "PageLoad", "PreRender", that sort of thing. It's also important that you be able to configure things like data sources in the HTML of the view where your controller can look it up and use it for the data binding event.
tvanfosson
Also, attach a LeprechaunOverlord to each class. ASP.NET MVC markup isn't nearly as ugly as ASP.NET WebForms markup, doesn't have VIEWSTATE XSS vulnerabilities etc. So we like to use the Leprechaun in this case.
James D