By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,312 Members | 1,280 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,312 IT Pros & Developers. It's quick & easy.

DataSourceAttribute for Unit Testing

P: n/a
Does anyone know if there is some way to specify a RELATIVE path to an .MDF
file for testing with the Team Unit Testing stuff in Visual Studio 2005?

The whole point of including a database with a Unit Test is to provide
testing data, so it can travel WITH the Unit test.

As such, I don't want to have to hard code a path to an MDF file.

i.e., I want to be able to do something like with the AttachDbFilename -

[DataSource("System.Data.SqlClient", @"Data
Source=.\SQLEXPRESS;AttachDbFilename=..\TEST.MDF;I ntegrated Security=True",
"TestConfig", DataAccessMethod.Random)]

Instead of:

[DataSource("System.Data.SqlClient", @"Data
Source=.\SQLEXPRESS;AttachDbFilename=c:\projects\m yproject\TEST.MDF;Integrated Security=True", "TestConfig", DataAccessMethod.Random)]
I could not find any other more obvious form in which to post this question,
so if someone knows a more appropriate form, please advise.

Jul 10 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.