Using MS Moles with datacontext and stored procedures without using a Connection string

415 views Asked by At

I have just begun to work with MS Moles for testing and I have followed the idea/pattern in which jcollum(thanks) uses a Mole for a table in this stackoverflow question here.

But I am having a problem as I do not want to have to pass a connection string when I use the datasource as such:

using (TheDataContext dataContext = new TheDataContext(myConnectionString))
{
   dataContext.ExecuteStoredprocedure(value, ref ValueExists);
}

I really like the fact that I just need to mole the table and everything else is done for me. I realize I could just mole the ExecuteStoredProcedure method, but I am wondering if I could just somehow avoid the sql exception I am getting here when I do not pass in the connection string. Or, if I there is a better way to do this?

Therefore, does anyone have a solution so that I can avoid placing in the connection string? Thanks in advance.

0

There are 0 answers