Testing ASP.NET MVC Routes (Both Web and API)

Lately, I was working on an ASP.NET MVC web application, and one of the questions that came up to me was: How do you deal with the application’s routing table when it comes to Unit Testing and Test-driven Development?

Routing is one of the areas of your application that can easily be screwed up – and these errors then have a high likelihood to go unnoticed and make it into production. And because even small to mid-size web projects will have dozens or even of hundreds of possible URLs I find it important to have a quick and reliable strategy to deal with such a scenario (covering a bulk of URLs through tests).

Read More

A Handy IIS Express (Test) Helper Class

Oftentimes, when developing or integration-testing a piece of software that is web-based (for example a web site or a web service component such as an Azure Mobile Service), being able to start and stop a web server programmatically on an as-needed basis comes in very handy.

This is where IIS Express comes into play. IIS Express basically is a lightweight, self-contained version of his big sibling, the fully fledged Internet Information Server. Because it doesn’t run as a service and doesn’t require administrator rights, it is ideally suited for developing and testing web sites and services locally – just like Visual Studio starts an instance of IIS Express when you hit F5 on a web application/service.

This post presents a helper class to programmatically interact with the IIS Express web server.

Read More