How can you use “external” configuration files (i.e. with configSource) with an MSTest unit test project?

后端 未结 3 811
误落风尘
误落风尘 2021-02-05 22:53

For simplicity, I generally split a lot of my configuration (i.e. the contents of app.config and web.config) out into separate .config files, and then reference them from the ma

3条回答
  •  遥遥无期
    2021-02-05 23:22

    Found it:

    If you edit the test run configuration (by double clicking the .testrunconfig file that gets put into the 'Solution Items' solution folder when you add a new unit test), you get a test run configuration dialog. There's a section there called 'Deployment' where you can specifiy files or whole folders from anywhere in the solution that can be copied out with the compiled assemblies at run time to the correct folder.

    In this way, I can now actually just define most of my configuration in one set of external .config files and have them automatically copied out at the run of each test.

提交回复
热议问题