I have been doing some Test-After Development unit testing on an ASP.NET MVC app and hit code that uses the cache through HttpContext.Current.Cache (I bet @serialseb would just love that!
) which as you may know is a royal pain in the arse for getting at or mocking without a web server.
As most sane people do I binged (that just does not sound right!) for an answer to my problem and came across a few interesting things but the closest I came initially was a post from Phil Haacked on his HttpSimulator cache where someone mentioned that using HttpRuntime got around the issue. I tired, it failed and I went back to Bing and came up with a post on Scott Hanselman’s blog where he details a conversation about simply including System.Web along with System.Web.Caching in non-web applications. I was skeptical but people have noted success with this method so I tried it and what did I find, it sodding well worked!
Granted the articles I found are old but this is the first time I have tried to unit test the Cache before so this was quite useful.
In other news I have ordered a copy of Working Effectively with Legacy Code by Michael Feathers from Amazon after @chriscanal recommended it, looking forward to having a read.

Things have been changing in my life over the past 2 years and I felt it was time to close the last few doors to my teenage life as I move forward. After 6 years of further and higher education I have entered into my first full-time job with the great folks over at
Ok, so I changed my Gamertag, why write a post about it? Two reasons, if I am on your Xbox Live or GFW Live friends list then you may be wondering who ForbiddenBacon is, well now you know. Second so I can close this door in my own mind and say goodbye to the tag that served me well for 7 years.