添加单元 测试
This commit is contained in:
31
DMS.Infrastructure.UnitTests/Services/DatabaseServiceTest.cs
Normal file
31
DMS.Infrastructure.UnitTests/Services/DatabaseServiceTest.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using DMS.Core.Interfaces;
|
||||
using DMS.Infrastructure.Configurations;
|
||||
using DMS.Infrastructure.Data;
|
||||
using DMS.Infrastructure.Services;
|
||||
|
||||
namespace DMS.Infrastructure.UnitTests.Services;
|
||||
|
||||
public class DatabaseServiceTest
|
||||
{
|
||||
|
||||
private IDatabaseService _databaseService;
|
||||
public DatabaseServiceTest()
|
||||
{
|
||||
AppSettings appSettings = new AppSettings();
|
||||
appSettings.Database.Database = "dms_test";
|
||||
SqlSugarDbContext dbContext=new SqlSugarDbContext(appSettings);
|
||||
_databaseService = new DatabaseService(dbContext);
|
||||
}
|
||||
[Fact]
|
||||
public void InitializeTables_Test()
|
||||
{
|
||||
_databaseService.InitializeTables();
|
||||
Assert.True(_databaseService.IsAnyTable("dbdevice"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void InitializeTableIndex_Test()
|
||||
{
|
||||
_databaseService.InitializeTableIndex();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user