title: How can I unit test my WCF client class?
body: <p>I have a class library that interacts with a WCF service, and uses an <code>app.config</code> file for its configuration.  I'd like to unit test this class, but when I run my unit test, I get:</p>
  
  <blockquote>
    <p>Could not find default endpoint element that references contract 'FooService' in the service model client configuaration section. This might be because no configuration file was found for your application or because no end point element matching this contract could be found in the client element</p>
  </blockquote>
  
  <p>According to <a href="https://stackoverflow.com/a/2737593/546561">this answer</a>, I need the <code>app.config</code> file to reside within my unit test project, and indeed this solves the problem.  But I really don't want to have to copy my <code>app.config</code> file around to unit tests every time I change it.</p>
  
  <p>I suppose I could add a link to the <code>app.config</code>, except that I'm using <a href="http://visualstudiogallery.msdn.microsoft.com/69023d00-a4f9-4a34-a6cd-7e854ba318b5" rel="nofollow noreferrer">SlowCheetah</a> to handle <code>app.config</code> transformations, so my <code>app.config</code> is generated at compile time.</p>
  
  <p>Is there anything I can do to get this to work, or do I just have to give up on my <code>app.config</code> and handle the configuration in code?</p>