This is one of the reasons why I use WCF for all of my API projects.
There are a lot of ways to test a WCF Service Application, that we are using. I would to do a disclaimer that this may be appropriate for our use but may not for your scenarios. Moreover, what we are testing are the “functionality” of the methods exposed by the service and on tests we bypass most of WCF’s infrastructure.
The first thing you have to make sure is that the service is testable. This a default WCF implementation if you create it directly from the Visual Studio project template.
You wanted to create the service as an abstract class and implement it as a partial class, we do this so that we split most of our logic into multiple files and for this context, which is a unit test discussion, to not to be confused about the references. As you can see, there are 353 references to the partial class and these are all from unit tests. From this point forward, the red class is our partial class.
Then you add the Service Implementation project as reference to the unit test projects. Make sure to add your Message and Data Contracts as well.
When you create the unit tests, you call the partial classes (in red) and then use it as it was just another class. Test it, use data source if you wish.
Note that this bypasses all WCF infrastructure and is only used for tests like its functionality and removing the networking component. You will also notice that you are not spawning any IIS or host the WCF service to run test against it.
This now can be checked-in in TFS and do automated tests in your CI.
Happy CI-ing WCF Services!