You have the option to point to another config file. The credit for the source goes to the Ron Hagerman for his answer with only slight modifications. The following xunit test may help with understanding on how to set the location. It is frustrating that .net core unit tests looks for the connection string in the testhost.dll.config file in the following directory
C:\Users\[UserName]\.nuget\packages\microsoft.testplatform.testhost\[version]\lib\netstandard1.5\testhost.dll.config
[Fact]
public void AccessAppSettings_ConnectionString()
{
//obtain the current directory for the executable
Uri UriAssemblyFolder = new Uri(System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly()
.GetName().CodeBase));
string appPath = UriAssemblyFolder.LocalPath;
//Change the "DataProvider.Tests.dll" to whatever your
//library or executable name.
//Note: Configuration manager will add the .config extension
Configuration config = ConfigurationManager
.OpenExeConfiguration(appPath + @"\" + "DataProvider.Tests.dll");
ConnectionStringsSection section =
config.GetSection("connectionStrings") as ConnectionStringsSection;
string expectedString = $"Data Source=mysqliteDBName.sqlite3";
//Change "mySqliteConnectionString" to your connection string name
var sut_connectionString =
section.ConnectionStrings ["mySqliteConnectionString"].ConnectionString;
Assert.NotNull(sut_connectionString);
Assert.Contains(expectedString, sut_connectionString);
Sample Config file:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<connectionStrings>
<add name="mySqliteConnectionString" connectionString="Data Source=mysqliteDBName.sqlite3" />
<add name="otherConnectionString" connectionString="Data Source=othersqliteDBName.sqlite3" />
</connectionStrings>
</configuration>