test(MongoDB): 增加单元测试
This commit is contained in:
parent
2b7fe380ba
commit
6c57170e96
|
@ -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<MongoBAWebHost>
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
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<string, string>[] {
|
||||
new KeyValuePair<string, string>("DB:0:Enabled", "false"),
|
||||
new KeyValuePair<string, string>("DB:1:Enabled", "false"),
|
||||
new KeyValuePair<string, string>("DB:2:Enabled", "false"),
|
||||
new KeyValuePair<string, string>("DB:3:Enabled", "false")
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
using Xunit;
|
||||
|
||||
namespace Bootstrap.DataAccess.MongoDB
|
||||
{
|
||||
[Collection("MongoContext")]
|
||||
public class AppTest : DataAccess.AppTest
|
||||
{
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
using Xunit;
|
||||
|
||||
namespace Bootstrap.DataAccess.MongoDB
|
||||
{
|
||||
[Collection("MongoContext")]
|
||||
public class DictsTest : DataAccess.DictsTest
|
||||
{
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
using Xunit;
|
||||
|
||||
namespace Bootstrap.DataAccess.MongoDB
|
||||
{
|
||||
[Collection("MongoContext")]
|
||||
public class ExceptionsTest : DataAccess.ExceptionsTest
|
||||
{
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
using Xunit;
|
||||
|
||||
namespace Bootstrap.DataAccess.MongoDB
|
||||
{
|
||||
[Collection("MongoContext")]
|
||||
public class GroupsTest : DataAccess.GroupsTest
|
||||
{
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
using Xunit;
|
||||
|
||||
namespace Bootstrap.DataAccess.MongoDB
|
||||
{
|
||||
[Collection("MongoContext")]
|
||||
public class LogsTest : DataAccess.LogsTest
|
||||
{
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
using Xunit;
|
||||
|
||||
namespace Bootstrap.DataAccess.MongoDB
|
||||
{
|
||||
[Collection("MongoContext")]
|
||||
public class MenusTest : DataAccess.MenusTest
|
||||
{
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
using Xunit;
|
||||
|
||||
namespace Bootstrap.DataAccess.MongoDB
|
||||
{
|
||||
[Collection("MongoContext")]
|
||||
public class MessagesTest : DataAccess.MessagesTest
|
||||
{
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
using Xunit;
|
||||
|
||||
namespace Bootstrap.DataAccess.MongoDB
|
||||
{
|
||||
[Collection("MongoContext")]
|
||||
public class RolesTest : DataAccess.RolesTest
|
||||
{
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
using Xunit;
|
||||
|
||||
namespace Bootstrap.DataAccess.MongoDB
|
||||
{
|
||||
[Collection("MongoContext")]
|
||||
public class TasksTest : DataAccess.TasksTest
|
||||
{
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
using Xunit;
|
||||
|
||||
namespace Bootstrap.DataAccess.MongoDB
|
||||
{
|
||||
[Collection("MongoContext")]
|
||||
public class TracesTest : DataAccess.TracesTest
|
||||
{
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
using Xunit;
|
||||
|
||||
namespace Bootstrap.DataAccess.MongoDB
|
||||
{
|
||||
[Collection("MongoContext")]
|
||||
public class UsersTest : DataAccess.UsersTest
|
||||
{
|
||||
|
||||
}
|
||||
}
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Bootstrap.Admin\Bootstrap.Admin.csproj" />
|
||||
<ProjectReference Include="..\Bootstrap.DataAccess.MongoDB\Bootstrap.DataAccess.MongoDB.csproj" />
|
||||
<ProjectReference Include="..\Bootstrap.DataAccess\Bootstrap.DataAccess.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
Loading…
Reference in New Issue