Embedding an ASP .NET application in a unit test (part 2)

In the previous part of this series I talked about how we set up a unit test to run a web application under an embedded instance of the Cassini web server. This takes care of the central component of the diagram below that illustrates our architecture.

So what about mocking the entire backend?


Embedding an ASP .NET application in a unit test (part 1)

We came across an interesting problem in SymbolSource recently. In the current architecture, the support for NuGet and OpenWrap is provided though so called gateways, that act as protocol adapters connecting to our SOAP API. In theory this provides a great testing opportunity, because it is easy to mock a set of relatively simple, procedural APIs.

A lot has been written about testing MVC applications: that this paradigm of programming is unit test friendly, because you can test the controller in isolation, or you could even try testing views. But what about configuration? Routing? Handlers? That can only be tested in an environment with a fully running web application. Because of this, I should probably have put integration testing in the post’s title, but since we wanted to focus on fully automating our gateway tests and running them with xUnit in CI, let’s keep the original term.

Starting a personal blog

I will try to make this as short as possible, because the longer the introduction is, the smaller are the chances of me continuing to write. I already had a false start in blogging a few years ago, but since that time SymbolSource happened and forced me to write more systematically. The number of posts I’ve put on the project’s blog actually amazes me, I never expected to have written that much, even if some of those posts are more like tweets. Here they are for reference:

It’s been an amazing year and a half since February 2010, when we went live with SymbolSource: from having just a crazy idea about reverse engineering srcsrv to becoming a well-known member of the .NET community. I’ve highlighted those posts that are still relevant or that are important to us, historically.

The blog at SymbolSource will remain focused on the project, here I hope to publish some other interesting materials on .NET, that do not necessarily fit there. Or perhaps even some occasional off-topics.