In my previous post I showed how to make a simple WCF service. In this post I will show you how to use this service without using a proxy. A proxy is used to connect to the service if you don't have access to the code of the service. Since we created the service ourselves it is sufficient to make a reference only.
For a project I did recently we were using devices that were connected with our server through a TCP connection. Every time we released a new version of the server software we had to restart the service which caused a disconnect event in all devices. Then, when the devices rebooted, they all try to connect at the same time, giving the service a hard time setting up all the connections.
In this article I will describe how to use the MOQ library in a basic test project in Visual studio 2012. Visual Studio provides a plain and simple way to make unit tests, but you cannot simply mock objects. Adding the Moq library makes live easier when you are building unit tests.