I am running SQL Server unit tests and have two test databases on which I want to test, "A" and "B". In my VSTS Release definition, I deploy my DACPAC files for both of these test DBs to the same server. In my app.config file that is copied to the build output, I have the following connection string, which references database "A" as the "Initial Catalog":
<SqlUnitTesting>
<DataGeneration ClearDatabase="true" />
<ExecutionContext Provider="System.Data.SqlClient" ConnectionString="Data Source=XYZ;Initial Catalog=A;Integrated Security=True;Pooling=False"
CommandTimeout="30000" />
<PrivilegedContext Provider="System.Data.SqlClient" ConnectionString="Data Source=XYZ;Initial Catalog=A;Integrated Security=True;Pooling=False"
CommandTimeout="30000" />
</SqlUnitTesting>
If I also want to connect to database "B", how can I do this?
- Could I create two Initial Catalogs in the same connection string?
- Could I create two configSections, where one has the connection string refer to "A" and the other refers to "B"?
- Could I remove Initial Catalog from my connection string so that it does not only limit me to "A"?
- Could I create two app.config files and have them in the same location?
Thank you.