test: 增加单元测试

This commit is contained in:
Argo-2016 2020-01-03 18:37:00 +08:00 committed by Argo Zhang
parent 4b0e8c22de
commit b65040af7e
No known key found for this signature in database
GPG Key ID: 152E398953DDF19F
4 changed files with 20 additions and 4 deletions

View File

@ -17,7 +17,6 @@ namespace Bootstrap.Admin.Api
Assert.NotNull(cates); Assert.NotNull(cates);
cates = await Client.GetAsJsonAsync<AnalyseData>("?logType=trace"); cates = await Client.GetAsJsonAsync<AnalyseData>("?logType=trace");
Assert.NotNull(cates); Assert.NotNull(cates);
} }
} }
} }

View File

@ -2,7 +2,7 @@
using UnitTest; using UnitTest;
using Xunit; using Xunit;
namespace Bootstrap.DataAccess namespace Bootstrap.DataAccess.SqlServer
{ {
[Collection("SQLServerContext")] [Collection("SQLServerContext")]
public class RollbackTest public class RollbackTest

View File

@ -1,4 +1,5 @@
using Xunit; using System.Linq;
using Xunit;
namespace Bootstrap.DataAccess.SQLite namespace Bootstrap.DataAccess.SQLite
{ {
@ -6,5 +7,21 @@ namespace Bootstrap.DataAccess.SQLite
public class DictsTest : SqlServer.DictsTest public class DictsTest : SqlServer.DictsTest
{ {
protected override string DatabaseName { get; set; } = "SQLite"; protected override string DatabaseName { get; set; } = "SQLite";
[Fact]
public void RetrieveHomeUrl_Ok()
{
Assert.Equal("~/Home/Index", DictHelper.RetrieveHomeUrl("Admin", ""));
var dict = DictHelper.RetrieveDicts().FirstOrDefault(d => d.Category == "系统设置" && d.Name == "默认应用程序");
Assert.NotNull(dict);
dict.Code = "1";
DictHelper.Save(dict);
Assert.Equal("http://localhost:49185/", DictHelper.RetrieveHomeUrl("Admin", "BA"));
dict.Code = "0";
DictHelper.Save(dict);
Assert.Equal("~/Home/Index", DictHelper.RetrieveHomeUrl("Admin", "BA"));
Assert.Equal("http://localhost:49185/", DictHelper.RetrieveHomeUrl("Admin", "Demo"));
}
} }
} }

View File

@ -4,7 +4,7 @@ using Longbow.Web;
using System.Linq; using System.Linq;
using Xunit; using Xunit;
namespace Bootstrap.DataAccess namespace Bootstrap.DataAccess.SqlServer
{ {
[Collection("SQLServerContext")] [Collection("SQLServerContext")]
[AutoRollback] [AutoRollback]