You should retrieve the connection string in the Web code and pass it
to the data access layer as a parameter. Your test code will pass the
same (or different) connection string, which can be hardcoded or taken
from a config file.

This is a typical case when testability requirements force design
improvement. It is considered a good practice to design your data
access in such a way that it doesn't know anything about your Web. In
fact, it should be perfectly functional in any application: console,
windows service etc.

ulu

On Feb 8, 1:18 pm, Vj <[EMAIL PROTECTED]> wrote:
> I have a web application created ( which is working good ), when I
> publish it in a location ( say E:\WebAppPublish\ ) then it is
> published successfully in the desired location. Now in the publishing
> location (  E:\WebAppPublish\  ), all the dlls are inside the bin (  E:
> \WebAppPublish\bin )  directory. These dlls contain my dataaccess
> layer ( used to open database connection ). The problem comes when I
> create a testcase library and test any method of my dataaccesslayer.
>
>     Here I would like to mention that my dataaccesslayer is designed
> in such a way that it takes the connection string from my web.config
> file residing on my root folder ( E:\WebAppPublish\ ). Since web
> config file is handled by .net framework at runtime, when I am testing
> mbunit test cases through MBUnit GUI control the web application
> cannot detect  the web.config file since it is not running on IIS
> framework. So while mbunit test runs the dataaccesslayer is unable to
> load connection string since it is mentioned in web.config which is in
> the publishing location.
>
> Is there any way in which I can make it work?
> Please feel free to ask anything in this matter.
>
> Regards,
> Vj
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"MbUnit.User" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/MbUnitUser?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to