I have a class library-- call it
Services.dll-- which is a wrapper for some third party functionality. The third party gave us a bunch of DLLs and those "inner" DLLs call a WCF service.
Services.dll is running, it lives within the web site's process, and uses the web.config associated with the site. So when I want to define the WCF client endpoints, I edit web.config. This is very straightforward.
But now I want to write an automated integration test suite. The test project is of course a class library (let's call it
Services.Tests.dll), so it will take whatever config is defined for the hosting process. But I think in the case of a test project, the hosting process is Visual Studio itself. The test project certainly does not emit an .exe of its own.
So where do I define the WCF client endpoints for the test project? Which config file do I edit? Do I edit
devenv.exe.config? Do I set up some kind of "satellite" config file (e.g.
Services.Tests.dll.config)-- if so, how do I get the Visual Studio test runner to pick up the config?
Or... is there a way to do this without config, by intercepting/mocking calls to
System.Configuration? I can't unfortunately change the third party DLLs.
Or.. do I override with some clever use of ServicePointManager, so that config is not an issue? Not sure how I would do that.
Or... is the best practice to write an integration test project not as a class library but as an .exe, with its own app.config?
Please note-- I am not running unit tests (those are separate). These are integration tests, so I don't want to isolate away the WCF calls. I need them, and I need them to be configured to point at the right test servers.