This article provides a detailed description on how use Pex and Moles to generate unit tests for a project having external dependency(WCF Proxy) using Visual Studio 2010 SP1. The Pex tool, which automatically generates test suites with high code coverage, will be used to generate unit tests. Moles allows to replace any .NET method with a delegate. They will be generated to isolate the external dependency (WCF proxy) and behavior will be redefined using delegates.