Hi, I try make my first simpel Data Driven Test.
- I created db (UnitTestsDb) with MS SQL Managmet studio, and also I created one db table (UsersTab).
I try use this db in unit test. Code is here:
[TestMethod()]
[TestProperty("TestCategory","Developer"),
DataSource("System.Data.SqlClient",
"Data Source=.\\SQLEXPRESS;AttachDbFilename=UnitTestsDb.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True",
"UsersTab", DataAccessMethod.Sequential)]
public void UserConstructorTest()
{//...}
But I get this error:
The unit test adapter failed to connect to the data source or to read the data. For more information on troubleshooting this error, see "Troubleshooting Data-Driven Unit Tests" (http://go.microsoft.com/fwlink/?LinkId=62412) in the MSDN Library. Error details: An attempt to attach an auto-named database for file UnitTestsDb.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
I have problem, how attached db file created with SQL Managment studio. Any advice? Thank you