.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Home >> Forum >> Others >> Post New QuestionBookmark and Share Subscribe to Forum

How to change the connection string for testing purpose?

Posted By: seattlegirl     Posted Date: February 16, 2012    Points:5   Category :Others
What to change for testing purpose ,without changeing any code in the dev code,so that the mock data(XML file) is called and not the actual data.How to write the code so that my code calls the XML file and not the database data without changeing the dev code?

Author: Amit Mehra             
Posted Date: February 17, 2012     Points: 20   


Which application you are talking about? Windows or web application? If its windows/console application you can change connection string in app.config file..if its web application or website you can have connection sting in web.config file.

Hope I understood your requirement properly

Please "Mark As Answer " if this post help you.
Author: seattlegirl             
Posted Date: February 17, 2012     Points: 20   


I understnd what you are saying and its an obvious answer but my question is not very simple.

How can you change the connection string in the test code?for testing purpose the dev method is accessed but
how can anything be altered inside that code so that when it executes then the mock data file is called and not the database.
Maybe my question is a little twisted so sorry if its not clear.

Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend