diff --git a/UnitTest/BAWebHost.cs b/UnitTest/BAWebHost.cs index bb12dc1f..d23a37cc 100644 --- a/UnitTest/BAWebHost.cs +++ b/UnitTest/BAWebHost.cs @@ -68,9 +68,6 @@ namespace Bootstrap.Admin new KeyValuePair("DB:2:Enabled", "false"), new KeyValuePair("DB:3:Enabled", "false") })); - if (!string.IsNullOrEmpty(TestHelper.MongoDBName)) builder.ConfigureAppConfiguration(app => app.AddInMemoryCollection(new KeyValuePair[] { - new KeyValuePair("MongoDB", TestHelper.MongoDBName) - })); } } @@ -128,13 +125,20 @@ namespace Bootstrap.Admin TestHelper.SQLServerConnectionString = con.GetConnectionString("sqlserver-app"); TestHelper.MySqlConnectionString = con.GetConnectionString("mysql-app"); TestHelper.NpgSqlConnectionString = con.GetConnectionString("npgsql-app"); + builder.ConfigureAppConfiguration(app => app.AddInMemoryCollection(new KeyValuePair[] { + new KeyValuePair("Logging:LogLevel:Default", "Error"), + new KeyValuePair("Logging:LogLevel:System", "Error"), + new KeyValuePair("Logging:LogLevel:Microsoft", "Error") + })); } else { TestHelper.SQLServerConnectionString = con.GetConnectionString("sqlserver"); TestHelper.MySqlConnectionString = con.GetConnectionString("mysql"); TestHelper.NpgSqlConnectionString = con.GetConnectionString("npgsql"); - TestHelper.MongoDBName = con.GetValue("MongoDB", "UnitTest"); + builder.ConfigureAppConfiguration(app => app.AddInMemoryCollection(new KeyValuePair[] { + new KeyValuePair("MongoDB", con.GetValue("MongoDB", "UnitTest")) + })); } TestHelper.SQLiteConnectionString = con.GetConnectionString("sqlite"); TestHelper.ConfigureWebHost(builder); diff --git a/UnitTest/TestHelper.cs b/UnitTest/TestHelper.cs index e1c3814a..3ca8a431 100644 --- a/UnitTest/TestHelper.cs +++ b/UnitTest/TestHelper.cs @@ -17,8 +17,6 @@ namespace UnitTest public static string NpgSqlConnectionString { get; set; } - public static string MongoDBName { get; set; } - /// /// 获得当前工程解决方案目录 /// diff --git a/UnitTest/appsettings.json b/UnitTest/appsettings.json index cb258d09..6c6c04a0 100644 --- a/UnitTest/appsettings.json +++ b/UnitTest/appsettings.json @@ -1,4 +1,9 @@ { + "Logging": { + "LogLevel": { + "Default": "Debug" + } + }, "MongoDB": "UnitTest", "ConnectionStrings": { "sqlite": "Data Source=UnitTest.db;",