A Testable WCF Wrapper

Keywords: WCF, C#, WCF Wrapper
Publish Date: 9/6/2015
Description: A Wcf Wrapper that will properly disposes of wcf resources

A Testable wcf Service Wrapper


Calling a wcf service requires some setup and tear down when done properly.


This code wraps the wcf call and takes care of closing and aborting the wcf client and channel factory. It also finds the configuration element automatically by the full name of the wcf interface. Note that you usually have to add the full namespace to the interface in the binding contract attribute for this code to work properly.






Source Code

VS2013 Source Code

The Service Wrapper Class

Example Usage

Service Wrapper Tests. This also has some cool sytax from NSubstitute and Fluent Assertions.

I got to try out Jet Brains Dot Cover on this project. I'm really liking it!

Dot Cover Results

Comments (3):

Name: Paul Roe
Comment Date: 9/8/2015
Nice wrapper brother, how are things?

Name: Allan Chadwick
Comment Date: 9/9/2015
Hey guys! Ya, this code might look slightly familiar.. lol.. I'll bet Mario has a better version already rocking in the new code base!

Name: Mario Hines
Comment Date: 9/8/2015
Very nice work.

Leave a Comment:

    Captcha Challenge