Patterns

NCheck: A object comparison helper

Paul Hatcher
Posted in Testing, Patterns
With unit testing one of the precepts is to check one thing in your test, but when you have objects this is difficult to express, since you want to check that the your business process has updated all of the expected properties (positive testing) and also that has not modified things that are not expected to have changed (negative testing). This becomes even more problematic when you have an object graph, e.

MVC Areas Anti-Pattern

Paul Hatcher
Posted in Patterns, MVC
I was working on the design of a small site where we have public display of information in one format and a set of administrative screens that allow authorised users to create and edit the information. “I know”, I thought, “this is a perfect case for MVC Areas” – and boy was I wrong! I should have realised that the problems had started when all the routing started playing up..

MVC 2 EditorForModel and DropDownList

Paul Hatcher
Posted in Patterns, MVC
Sometimes doing very basic things can be quite tricky in new technologies; case in point presenting a DropDownList (a ComboBox to those, including me, with a VB background) using the new EditorForModel syntax in ASP.NET MVC 2. I had a little class in my MVP framework called IdLabel which as the name implied just held an Id and a Label so that I wasn’t forced to have a separate display and edit model for every trivial case, so I wanted to do the same sort of thing when writing my shiny new MVC apps.

Debugging ASP.NET MVC 2 Source Code

Paul Hatcher
Posted in Patterns, MVC
I’m trying to write some templates for MVC 2 and one of the most useful things I’ve found is being able to step into the source code and see how it is actually interpreting what you’ve written. It’s easy enough to acquire the source, but what you might not have done before is set up a symbol server. A symbol server is a location that the Windows and Visual Studio debugging tools can use to obtain pdb files, so that you can debug almost anything, including drivers and the operating system!