2

I need read connection string from web.config which in asp.net mvc project, but all i get are null. how can i obtain connection string in mstest, do i need additional configuration in some where?

1 Answer 1

2

You can include the web.config file as part of the test project output by including the deployment item attribute in your test class:

[TestClass()]
[DeploymentItem("Web.Config")]
public class myClassTest
{
}

Then you should be able to retrieve your connection string as usual in the class you are trying to test:

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.