I'm trying to run unit tests out of NUnit that are centered around databases. The tests just access the localdb but NUnit keeps giving errors. I've set up a localdb (or so I think), but the sql command isn't recognizing it.
Exception occurred while deleting from table: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 50 - Local Database Runtime error occurred. The specified LocalDB instance does not exist.
Here is the path for the sql command in the unit test:
private const string ConnectionString_ = "Data Source=(localdb)\\Projects;Initial Catalog=MetricsBusDatabase;Integrated Security=SSPI;";
I've read over most of the related sql questions and I'm currently reinstalling the sql server. No one seems to be getting the same error. I suspect I've missed something very simple.
I think you should change the Data Source to (localdb)\v11.0. If you are using VS2015, you can use (localdb)\MSSQLLocalDB as Data Source. So in your case it should be the following.
or