Unit Testing WCF Services

A colleague of mine recently wrote about seperation of concerns in relation to unit testing WCF services. 

It may be possible to expose a library directly in WCF but I would rather see an architecture like the one presented in the Service Software Factory with a clear separation of concerns.

In my opinion it makes little or no sense to create unit tests for anything but the layers below the Service Interface Layer (SIL, see below). While it is possible to create unit tests for the the Service Interface Layer it makes much more sense to build integration tests for this layer. OperationContext and every bit of logic related to information kept here should be handled in the SIL.

This also means that Service operations are implemented in the SIL and that this is where we filter all the transport / protocol logic (if any) away before the call is forwarded to the business layer.

service architecture