diff --git a/UnitTest/BAWebHost.cs b/UnitTest/BAWebHost.cs index 0d9b7313..e32c9da5 100644 --- a/UnitTest/BAWebHost.cs +++ b/UnitTest/BAWebHost.cs @@ -1,8 +1,10 @@ -using Microsoft.AspNetCore.Hosting; +using Longbow.Data; +using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc.Testing; using Microsoft.AspNetCore.Mvc.Testing.Handlers; using Microsoft.Extensions.Configuration; using System; +using System.Collections.Generic; using System.Net; using System.Net.Http; using UnitTest; @@ -28,13 +30,19 @@ namespace Bootstrap.Admin } + [CollectionDefinition("MongoContext")] + public class MongoContext : ICollectionFixture + { + + } + public class MySqlBAWebHost : BAWebHost { protected override void ConfigureWebHost(IWebHostBuilder builder) { base.ConfigureWebHost(builder); - TestHelper.ConfigureWebHost(builder, Longbow.Data.DatabaseProviderType.MySql); + TestHelper.ConfigureWebHost(builder, DatabaseProviderType.MySql); } } @@ -44,7 +52,22 @@ namespace Bootstrap.Admin { base.ConfigureWebHost(builder); - TestHelper.ConfigureWebHost(builder, Longbow.Data.DatabaseProviderType.SQLite); + TestHelper.ConfigureWebHost(builder, DatabaseProviderType.SQLite); + } + } + + public class MongoBAWebHost : BAWebHost + { + protected override void ConfigureWebHost(IWebHostBuilder builder) + { + base.ConfigureWebHost(builder); + + builder.ConfigureAppConfiguration(app => app.AddInMemoryCollection(new KeyValuePair[] { + new KeyValuePair("DB:0:Enabled", "false"), + new KeyValuePair("DB:1:Enabled", "false"), + new KeyValuePair("DB:2:Enabled", "false"), + new KeyValuePair("DB:3:Enabled", "false") + })); } } diff --git a/UnitTest/Bootstrap.DataAccess/MongoDB/AppTest.cs b/UnitTest/Bootstrap.DataAccess/MongoDB/AppTest.cs new file mode 100644 index 00000000..9d1e2fb0 --- /dev/null +++ b/UnitTest/Bootstrap.DataAccess/MongoDB/AppTest.cs @@ -0,0 +1,10 @@ +using Xunit; + +namespace Bootstrap.DataAccess.MongoDB +{ + [Collection("MongoContext")] + public class AppTest : DataAccess.AppTest + { + + } +} diff --git a/UnitTest/Bootstrap.DataAccess/MongoDB/DictsTest.cs b/UnitTest/Bootstrap.DataAccess/MongoDB/DictsTest.cs new file mode 100644 index 00000000..de9323b7 --- /dev/null +++ b/UnitTest/Bootstrap.DataAccess/MongoDB/DictsTest.cs @@ -0,0 +1,10 @@ +using Xunit; + +namespace Bootstrap.DataAccess.MongoDB +{ + [Collection("MongoContext")] + public class DictsTest : DataAccess.DictsTest + { + + } +} diff --git a/UnitTest/Bootstrap.DataAccess/MongoDB/ExceptionsTest.cs b/UnitTest/Bootstrap.DataAccess/MongoDB/ExceptionsTest.cs new file mode 100644 index 00000000..303bce7b --- /dev/null +++ b/UnitTest/Bootstrap.DataAccess/MongoDB/ExceptionsTest.cs @@ -0,0 +1,10 @@ +using Xunit; + +namespace Bootstrap.DataAccess.MongoDB +{ + [Collection("MongoContext")] + public class ExceptionsTest : DataAccess.ExceptionsTest + { + + } +} diff --git a/UnitTest/Bootstrap.DataAccess/MongoDB/GroupsTest.cs b/UnitTest/Bootstrap.DataAccess/MongoDB/GroupsTest.cs new file mode 100644 index 00000000..da659a26 --- /dev/null +++ b/UnitTest/Bootstrap.DataAccess/MongoDB/GroupsTest.cs @@ -0,0 +1,10 @@ +using Xunit; + +namespace Bootstrap.DataAccess.MongoDB +{ + [Collection("MongoContext")] + public class GroupsTest : DataAccess.GroupsTest + { + + } +} diff --git a/UnitTest/Bootstrap.DataAccess/MongoDB/LogsTest.cs b/UnitTest/Bootstrap.DataAccess/MongoDB/LogsTest.cs new file mode 100644 index 00000000..ef638d98 --- /dev/null +++ b/UnitTest/Bootstrap.DataAccess/MongoDB/LogsTest.cs @@ -0,0 +1,10 @@ +using Xunit; + +namespace Bootstrap.DataAccess.MongoDB +{ + [Collection("MongoContext")] + public class LogsTest : DataAccess.LogsTest + { + + } +} diff --git a/UnitTest/Bootstrap.DataAccess/MongoDB/MenusTest.cs b/UnitTest/Bootstrap.DataAccess/MongoDB/MenusTest.cs new file mode 100644 index 00000000..660d8489 --- /dev/null +++ b/UnitTest/Bootstrap.DataAccess/MongoDB/MenusTest.cs @@ -0,0 +1,10 @@ +using Xunit; + +namespace Bootstrap.DataAccess.MongoDB +{ + [Collection("MongoContext")] + public class MenusTest : DataAccess.MenusTest + { + + } +} diff --git a/UnitTest/Bootstrap.DataAccess/MongoDB/MessagesTest.cs b/UnitTest/Bootstrap.DataAccess/MongoDB/MessagesTest.cs new file mode 100644 index 00000000..69786ee9 --- /dev/null +++ b/UnitTest/Bootstrap.DataAccess/MongoDB/MessagesTest.cs @@ -0,0 +1,10 @@ +using Xunit; + +namespace Bootstrap.DataAccess.MongoDB +{ + [Collection("MongoContext")] + public class MessagesTest : DataAccess.MessagesTest + { + + } +} diff --git a/UnitTest/Bootstrap.DataAccess/MongoDB/RolesTest.cs b/UnitTest/Bootstrap.DataAccess/MongoDB/RolesTest.cs new file mode 100644 index 00000000..5983a98f --- /dev/null +++ b/UnitTest/Bootstrap.DataAccess/MongoDB/RolesTest.cs @@ -0,0 +1,10 @@ +using Xunit; + +namespace Bootstrap.DataAccess.MongoDB +{ + [Collection("MongoContext")] + public class RolesTest : DataAccess.RolesTest + { + + } +} diff --git a/UnitTest/Bootstrap.DataAccess/MongoDB/TasksTest.cs b/UnitTest/Bootstrap.DataAccess/MongoDB/TasksTest.cs new file mode 100644 index 00000000..d2760cc9 --- /dev/null +++ b/UnitTest/Bootstrap.DataAccess/MongoDB/TasksTest.cs @@ -0,0 +1,10 @@ +using Xunit; + +namespace Bootstrap.DataAccess.MongoDB +{ + [Collection("MongoContext")] + public class TasksTest : DataAccess.TasksTest + { + + } +} diff --git a/UnitTest/Bootstrap.DataAccess/MongoDB/TracesTest.cs b/UnitTest/Bootstrap.DataAccess/MongoDB/TracesTest.cs new file mode 100644 index 00000000..da72962c --- /dev/null +++ b/UnitTest/Bootstrap.DataAccess/MongoDB/TracesTest.cs @@ -0,0 +1,10 @@ +using Xunit; + +namespace Bootstrap.DataAccess.MongoDB +{ + [Collection("MongoContext")] + public class TracesTest : DataAccess.TracesTest + { + + } +} diff --git a/UnitTest/Bootstrap.DataAccess/MongoDB/UsersTest.cs b/UnitTest/Bootstrap.DataAccess/MongoDB/UsersTest.cs new file mode 100644 index 00000000..e64c6eca --- /dev/null +++ b/UnitTest/Bootstrap.DataAccess/MongoDB/UsersTest.cs @@ -0,0 +1,10 @@ +using Xunit; + +namespace Bootstrap.DataAccess.MongoDB +{ + [Collection("MongoContext")] + public class UsersTest : DataAccess.UsersTest + { + + } +} diff --git a/UnitTest/UnitTest.csproj b/UnitTest/UnitTest.csproj index dd5e3b10..b7da0c64 100644 --- a/UnitTest/UnitTest.csproj +++ b/UnitTest/UnitTest.csproj @@ -22,6 +22,7 @@ +