test(build): 增加Logging默认等级

This commit is contained in:
Argo Zhang 2019-05-15 11:08:31 +08:00
parent f88ebe12ee
commit 75e9eac8e2
3 changed files with 13 additions and 6 deletions

View File

@ -68,9 +68,6 @@ namespace Bootstrap.Admin
new KeyValuePair<string, string>("DB:2:Enabled", "false"), new KeyValuePair<string, string>("DB:2:Enabled", "false"),
new KeyValuePair<string, string>("DB:3:Enabled", "false") new KeyValuePair<string, string>("DB:3:Enabled", "false")
})); }));
if (!string.IsNullOrEmpty(TestHelper.MongoDBName)) builder.ConfigureAppConfiguration(app => app.AddInMemoryCollection(new KeyValuePair<string, string>[] {
new KeyValuePair<string, string>("MongoDB", TestHelper.MongoDBName)
}));
} }
} }
@ -128,13 +125,20 @@ namespace Bootstrap.Admin
TestHelper.SQLServerConnectionString = con.GetConnectionString("sqlserver-app"); TestHelper.SQLServerConnectionString = con.GetConnectionString("sqlserver-app");
TestHelper.MySqlConnectionString = con.GetConnectionString("mysql-app"); TestHelper.MySqlConnectionString = con.GetConnectionString("mysql-app");
TestHelper.NpgSqlConnectionString = con.GetConnectionString("npgsql-app"); TestHelper.NpgSqlConnectionString = con.GetConnectionString("npgsql-app");
builder.ConfigureAppConfiguration(app => app.AddInMemoryCollection(new KeyValuePair<string, string>[] {
new KeyValuePair<string, string>("Logging:LogLevel:Default", "Error"),
new KeyValuePair<string, string>("Logging:LogLevel:System", "Error"),
new KeyValuePair<string, string>("Logging:LogLevel:Microsoft", "Error")
}));
} }
else else
{ {
TestHelper.SQLServerConnectionString = con.GetConnectionString("sqlserver"); TestHelper.SQLServerConnectionString = con.GetConnectionString("sqlserver");
TestHelper.MySqlConnectionString = con.GetConnectionString("mysql"); TestHelper.MySqlConnectionString = con.GetConnectionString("mysql");
TestHelper.NpgSqlConnectionString = con.GetConnectionString("npgsql"); TestHelper.NpgSqlConnectionString = con.GetConnectionString("npgsql");
TestHelper.MongoDBName = con.GetValue("MongoDB", "UnitTest"); builder.ConfigureAppConfiguration(app => app.AddInMemoryCollection(new KeyValuePair<string, string>[] {
new KeyValuePair<string, string>("MongoDB", con.GetValue("MongoDB", "UnitTest"))
}));
} }
TestHelper.SQLiteConnectionString = con.GetConnectionString("sqlite"); TestHelper.SQLiteConnectionString = con.GetConnectionString("sqlite");
TestHelper.ConfigureWebHost(builder); TestHelper.ConfigureWebHost(builder);

View File

@ -17,8 +17,6 @@ namespace UnitTest
public static string NpgSqlConnectionString { get; set; } public static string NpgSqlConnectionString { get; set; }
public static string MongoDBName { get; set; }
/// <summary> /// <summary>
/// 获得当前工程解决方案目录 /// 获得当前工程解决方案目录
/// </summary> /// </summary>

View File

@ -1,4 +1,9 @@
{ {
"Logging": {
"LogLevel": {
"Default": "Debug"
}
},
"MongoDB": "UnitTest", "MongoDB": "UnitTest",
"ConnectionStrings": { "ConnectionStrings": {
"sqlite": "Data Source=UnitTest.db;", "sqlite": "Data Source=UnitTest.db;",