简体   繁体   中英

How to read app.config values in C# Test Project

I have a Project for which i am writing unit testing, I need to read values of app.config of project file in Test Project for which I dont want to copy app.config in my test project

How do I achieve this?

在测试项目中,选择添加现有项,选择app.config并选中add as link

You can read settings by using System.Configuration.ConfigurationManager.AppSettings["key"] .

If you don't want two copies of app.config but want the same settings for both projects, then you can add the file as a link

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM