单元测试:测试文件增加多数据库配置项

This commit is contained in:
Argo-Surface 2019-01-12 00:34:39 +08:00
parent 2f5be3a1d0
commit 5e188ebfcf
1 changed files with 11 additions and 1 deletions

View File

@ -8,9 +8,19 @@ namespace Bootstrap.DataAccess
{ {
public BootstrapAdminStartup() public BootstrapAdminStartup()
{ {
var sqlConnectionStrings = "Data Source=.;Initial Catalog=UnitTest;User ID=sa;Password=sa";
var mysqlConnectionStrings = "Server=10.211.55.2;Database=BA;Uid=argozhang;Pwd=argo@163.com;SslMode=none;";
var config = new ConfigurationBuilder().AddInMemoryCollection(new KeyValuePair<string, string>[] { var config = new ConfigurationBuilder().AddInMemoryCollection(new KeyValuePair<string, string>[] {
new KeyValuePair<string, string>("ConnectionStrings:ba", "Data Source=.;Initial Catalog=UnitTest;User ID=sa;Password=sa"), new KeyValuePair<string, string>("ConnectionStrings:ba", sqlConnectionStrings),
new KeyValuePair<string, string>("DB:0:Enabled", "false"), new KeyValuePair<string, string>("DB:0:Enabled", "false"),
new KeyValuePair<string, string>("DB:1:Enabled", "false"),
new KeyValuePair<string, string>("DB:1:ProviderName", "SQLite"),
new KeyValuePair<string, string>("DB:1:ConnectionStrings:ba", "Data Source=UnitTest.db"),
new KeyValuePair<string, string>("DB:2:Enabled", "false"),
new KeyValuePair<string, string>("DB:2:ProviderName", "MySql"),
new KeyValuePair<string, string>("DB:2:ConnectionStrings:ba", mysqlConnectionStrings),
new KeyValuePair<string, string>("LongbowCache:Enabled", "false") new KeyValuePair<string, string>("LongbowCache:Enabled", "false")
}).Build(); }).Build();
var sc = new ServiceCollection(); var sc = new ServiceCollection();