/// <summary> /// Returns a SQL connection string that points at the specified database /// in the shared SQL LocalDB instance in use by the test assembly. /// </summary> /// <param name="initialCatalog">The name of the database.</param> /// <returns> /// The SQL connection string to use to connect to the specified database. /// </returns> internal static string GetConnectionStringForDatabase(string initialCatalog) { // Get the base SQL connection string to the SQL LocalDB instance. // If it has not already been created it will be created now. DbConnectionStringBuilder builder = SharedInstance.Value.CreateConnectionStringBuilder(); // Update the catalog name to the specified database name builder.SetInitialCatalogName(initialCatalog); // Return the modified SQL connection string which points at the // shared SQL LocalDB instance and the specified database. return(builder.ConnectionString); }