test: 增加 LogHelper.DbLogTask 单元测试

This commit is contained in:
Argo Zhang 2019-10-09 23:08:55 +08:00
parent 1447d52072
commit c43d6be089
No known key found for this signature in database
GPG Key ID: 152E398953DDF19F
2 changed files with 26 additions and 1 deletions

View File

@ -38,7 +38,7 @@
function runUnitTest() { function runUnitTest() {
write-host "dotnet test test\UnitTest" -ForegroundColor Cyan write-host "dotnet test test\UnitTest" -ForegroundColor Cyan
dotnet test test\UnitTest --filter="FullyQualifiedName!~MySql" /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Include="[Bootstrap.Admin*]*%2c[Bootstrap.DataAccess*]*" /p:Exclude="[*]*Program%2c[*]*Startup%2c[Bootstrap.DataAccess]*AutoDB%2c[Bootstrap.DataAccess]*WeChatHelper%2c[Bootstrap.DataAccess]*DbLogTask" /p:ExcludeByFile="**/SMSExtensions.cs%2c**/Helper/OAuthHelper.cs" /p:CoverletOutput=..\..\ dotnet test test\UnitTest --filter="FullyQualifiedName!~MySql" /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Include="[Bootstrap.Admin*]*%2c[Bootstrap.DataAccess*]*" /p:Exclude="[*]*Program%2c[*]*Startup%2c[Bootstrap.DataAccess]*AutoDB%2c[Bootstrap.DataAccess]*WeChatHelper" /p:ExcludeByFile="**/SMSExtensions.cs%2c**/Helper/OAuthHelper.cs" /p:CoverletOutput=..\..\
} }
function coverallUnitTest() { function coverallUnitTest() {

View File

@ -0,0 +1,25 @@
using System;
using System.Threading;
using Xunit;
namespace Bootstrap.DataAccess.SQLite
{
[Collection("SQLiteContext")]
public class LogHelperTest
{
[Fact]
public void Task_Ok()
{
var log = new DBLog()
{
Id = "",
LogTime = DateTime.Now,
SQL = "UnitTest",
UserName = "Admin"
};
LogHelper.AddDBLog(log);
var task = new LogHelper.DbLogTask();
task.Execute(CancellationToken.None);
}
}
}