Design principles and testing
While I really enjoyed reading Fredrik Vigs latest megablog about EPiServer developer resources I felt slightly depressed that the area of testing and design principles was more or less missing. This isn’t Fredriks fault of course since there aren’t (m)any articles on the subject here or on other episerver related pages. I’m in no way an expert on the field but I’m going to go out on a limb here and write a few posts about these subjects. Maybe I’ll wake up a some test fanatics, design dorks and a few regular alt.net hecklers from their beauty sleep in the process.
To serve as a sort of base for the posts I’m going to have the following scenario:
Our page is going to display the weather for the current day. For this we’re going to be using yr.no.
The page also contains a text area where a visitor can write some text and then save it. Upon save some formatting of the text is done before saving the text as the page MainBody.
The code we’re going to be working with looks like this
In the next few posts we’re going to refactor this code and write some tests for it. What I’m aiming for is to sort of give an explanation of some basic design principles, how they relate to testing and why it should matter to you. I also hope to have created world peace in the process.